Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3283)

Unified Diff: chrome/browser/renderer_host/file_system_accessor.cc

Issue 338065: Add the ability for objects which derive from RefCountedThreadSafe to specify... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/file_system_accessor.cc
===================================================================
--- chrome/browser/renderer_host/file_system_accessor.cc (revision 30647)
+++ chrome/browser/renderer_host/file_system_accessor.cc (working copy)
@@ -1,44 +0,0 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/renderer_host/file_system_accessor.h"
-
-#include "base/file_util.h"
-#include "base/message_loop.h"
-#include "chrome/browser/chrome_thread.h"
-
-FileSystemAccessor::FileSystemAccessor(void* param, FileSizeCallback* callback)
- : param_(param), callback_(callback) {
- caller_loop_ = MessageLoop::current();
-}
-
-FileSystemAccessor::~FileSystemAccessor() {
-}
-
-void FileSystemAccessor::RequestFileSize(const FilePath& path,
- void* param,
- FileSizeCallback* callback) {
- // Getting file size could take long time if it lives on a network share,
- // so run it on FILE thread.
- ChromeThread::PostTask(
- ChromeThread::FILE, FROM_HERE,
- NewRunnableMethod(new FileSystemAccessor(param, callback),
- &FileSystemAccessor::GetFileSize, path));
-}
-
-void FileSystemAccessor::GetFileSize(const FilePath& path) {
- int64 result;
- // Set result to -1 if failed to get file size.
- if (!file_util::GetFileSize(path, &result))
- result = -1;
-
- // Pass the result back to the caller thread.
- caller_loop_->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &FileSystemAccessor::GetFileSizeCompleted, result));
-}
-
-void FileSystemAccessor::GetFileSizeCompleted(int64 result) {
- callback_->Run(result, param_);
-}
« no previous file with comments | « chrome/browser/renderer_host/file_system_accessor.h ('k') | chrome/browser/renderer_host/file_system_accessor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698