Commit 9becf77c authored by kinuko@chromium.org's avatar kinuko@chromium.org

Change ShareableFileReference to take TaskRunner instead of MessageLoopProxy

BUG=none
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10825069

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148893 0039d316-1c4b-4281-b951-d872f2087c98
parent 2916724d
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/file_util.h" #include "base/file_util.h"
#include "base/file_util_proxy.h" #include "base/file_util_proxy.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/message_loop_proxy.h" #include "base/task_runner.h"
namespace webkit_blob { namespace webkit_blob {
...@@ -31,8 +31,8 @@ scoped_refptr<ShareableFileReference> ShareableFileReference::Get( ...@@ -31,8 +31,8 @@ scoped_refptr<ShareableFileReference> ShareableFileReference::Get(
// static // static
scoped_refptr<ShareableFileReference> ShareableFileReference::GetOrCreate( scoped_refptr<ShareableFileReference> ShareableFileReference::GetOrCreate(
const FilePath& path, FinalReleasePolicy policy, const FilePath& path, FinalReleasePolicy policy,
base::MessageLoopProxy* file_thread) { base::TaskRunner* file_task_runner) {
DCHECK(file_thread); DCHECK(file_task_runner);
typedef std::pair<ShareableFileMap::iterator, bool> InsertResult; typedef std::pair<ShareableFileMap::iterator, bool> InsertResult;
// Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair // Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair
...@@ -44,7 +44,7 @@ scoped_refptr<ShareableFileReference> ShareableFileReference::GetOrCreate( ...@@ -44,7 +44,7 @@ scoped_refptr<ShareableFileReference> ShareableFileReference::GetOrCreate(
// Wasn't in the map, create a new reference and store the pointer. // Wasn't in the map, create a new reference and store the pointer.
scoped_refptr<ShareableFileReference> reference( scoped_refptr<ShareableFileReference> reference(
new ShareableFileReference(path, policy, file_thread)); new ShareableFileReference(path, policy, file_task_runner));
result.first->second = reference.get(); result.first->second = reference.get();
return reference; return reference;
} }
...@@ -56,8 +56,10 @@ void ShareableFileReference::AddFinalReleaseCallback( ...@@ -56,8 +56,10 @@ void ShareableFileReference::AddFinalReleaseCallback(
ShareableFileReference::ShareableFileReference( ShareableFileReference::ShareableFileReference(
const FilePath& path, FinalReleasePolicy policy, const FilePath& path, FinalReleasePolicy policy,
base::MessageLoopProxy* file_thread) base::TaskRunner* file_task_runner)
: path_(path), final_release_policy_(policy), file_thread_(file_thread) { : path_(path),
final_release_policy_(policy),
file_task_runner_(file_task_runner) {
DCHECK(g_file_map.Get().find(path_)->second == NULL); DCHECK(g_file_map.Get().find(path_)->second == NULL);
} }
...@@ -69,7 +71,7 @@ ShareableFileReference::~ShareableFileReference() { ...@@ -69,7 +71,7 @@ ShareableFileReference::~ShareableFileReference() {
final_release_callbacks_[i].Run(path_); final_release_callbacks_[i].Run(path_);
if (final_release_policy_ == DELETE_ON_FINAL_RELEASE) { if (final_release_policy_ == DELETE_ON_FINAL_RELEASE) {
base::FileUtilProxy::Delete(file_thread_, path_, false /* recursive */, base::FileUtilProxy::Delete(file_task_runner_, path_, false /* recursive */,
base::FileUtilProxy::StatusCallback()); base::FileUtilProxy::StatusCallback());
} }
} }
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "webkit/blob/blob_export.h" #include "webkit/blob/blob_export.h"
namespace base { namespace base {
class MessageLoopProxy; class TaskRunner;
} }
namespace webkit_blob { namespace webkit_blob {
...@@ -42,7 +42,7 @@ class BLOB_EXPORT ShareableFileReference ...@@ -42,7 +42,7 @@ class BLOB_EXPORT ShareableFileReference
static scoped_refptr<ShareableFileReference> GetOrCreate( static scoped_refptr<ShareableFileReference> GetOrCreate(
const FilePath& path, const FilePath& path,
FinalReleasePolicy policy, FinalReleasePolicy policy,
base::MessageLoopProxy* file_thread); base::TaskRunner* file_task_runner);
// The full file path. // The full file path.
const FilePath& path() const { return path_; } const FilePath& path() const { return path_; }
...@@ -60,12 +60,12 @@ class BLOB_EXPORT ShareableFileReference ...@@ -60,12 +60,12 @@ class BLOB_EXPORT ShareableFileReference
ShareableFileReference( ShareableFileReference(
const FilePath& path, const FilePath& path,
FinalReleasePolicy policy, FinalReleasePolicy policy,
base::MessageLoopProxy* file_thread); base::TaskRunner* file_task_runner);
~ShareableFileReference(); ~ShareableFileReference();
const FilePath path_; const FilePath path_;
const FinalReleasePolicy final_release_policy_; const FinalReleasePolicy final_release_policy_;
const scoped_refptr<base::MessageLoopProxy> file_thread_; const scoped_refptr<base::TaskRunner> file_task_runner_;
std::vector<FinalReleaseCallback> final_release_callbacks_; std::vector<FinalReleaseCallback> final_release_callbacks_;
DISALLOW_COPY_AND_ASSIGN(ShareableFileReference); DISALLOW_COPY_AND_ASSIGN(ShareableFileReference);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment