diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-29 23:00:00 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-29 23:00:00 +0000 |
commit | a5230508efeea42e05005f43f9ffa140fbcc64c0 (patch) | |
tree | 89b4aedc784c9b0b1c93b757b35631e0fd06a884 /webkit | |
parent | 55df9099f9350d906d7b03a4390687ac95269210 (diff) | |
download | chromium_src-a5230508efeea42e05005f43f9ffa140fbcc64c0.zip chromium_src-a5230508efeea42e05005f43f9ffa140fbcc64c0.tar.gz chromium_src-a5230508efeea42e05005f43f9ffa140fbcc64c0.tar.bz2 |
Modify DeletableFileReference to not necessarily delete after all. Renamed the class to ShareableFileReference and fixed up the current callers with the new name and gypi files.
BUG=115603
Review URL: https://chromiumcodereview.appspot.com/9466025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/blob/blob_data.h | 8 | ||||
-rw-r--r-- | webkit/blob/blob_storage_controller.cc | 8 | ||||
-rw-r--r-- | webkit/blob/deletable_file_reference.cc | 73 | ||||
-rw-r--r-- | webkit/blob/deletable_file_reference.h | 60 | ||||
-rw-r--r-- | webkit/blob/shareable_file_reference.cc | 77 | ||||
-rw-r--r-- | webkit/blob/shareable_file_reference.h | 77 | ||||
-rw-r--r-- | webkit/blob/shareable_file_reference_unittest.cc (renamed from webkit/blob/deletable_file_reference_unittest.cc) | 24 | ||||
-rw-r--r-- | webkit/blob/webkit_blob.gypi | 4 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation.cc | 4 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_interface.h | 13 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_unittest.cc | 20 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_file_system.cc | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_file_system.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_resource_loader_bridge.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 2 |
15 files changed, 206 insertions, 181 deletions
diff --git a/webkit/blob/blob_data.h b/webkit/blob/blob_data.h index b5d9460..c1296a3 100644 --- a/webkit/blob/blob_data.h +++ b/webkit/blob/blob_data.h @@ -13,7 +13,7 @@ #include "base/time.h" #include "googleurl/src/gurl.h" #include "webkit/blob/blob_export.h" -#include "webkit/blob/deletable_file_reference.h" +#include "webkit/blob/shareable_file_reference.h" namespace WebKit { class WebBlobData; @@ -104,8 +104,8 @@ class BLOB_EXPORT BlobData : public base::RefCounted<BlobData> { items_.back().SetToBlob(blob_url, offset, length); } - void AttachDeletableFileReference(DeletableFileReference* reference) { - deletable_files_.push_back(reference); + void AttachShareableFileReference(ShareableFileReference* reference) { + shareable_files_.push_back(reference); } const std::vector<Item>& items() const { return items_; } @@ -140,7 +140,7 @@ class BLOB_EXPORT BlobData : public base::RefCounted<BlobData> { std::string content_type_; std::string content_disposition_; std::vector<Item> items_; - std::vector<scoped_refptr<DeletableFileReference> > deletable_files_; + std::vector<scoped_refptr<ShareableFileReference> > shareable_files_; DISALLOW_COPY_AND_ASSIGN(BlobData); }; diff --git a/webkit/blob/blob_storage_controller.cc b/webkit/blob/blob_storage_controller.cc index 6490c66..e3bcc6f 100644 --- a/webkit/blob/blob_storage_controller.cc +++ b/webkit/blob/blob_storage_controller.cc @@ -274,10 +274,10 @@ void BlobStorageController::AppendFileItem( expected_modification_time); // It may be a temporary file that should be deleted when no longer needed. - scoped_refptr<DeletableFileReference> deletable_file = - DeletableFileReference::Get(file_path); - if (deletable_file) - target_blob_data->AttachDeletableFileReference(deletable_file); + scoped_refptr<ShareableFileReference> shareable_file = + ShareableFileReference::Get(file_path); + if (shareable_file) + target_blob_data->AttachShareableFileReference(shareable_file); } void BlobStorageController::IncrementBlobDataUsage(BlobData* blob_data) { diff --git a/webkit/blob/deletable_file_reference.cc b/webkit/blob/deletable_file_reference.cc deleted file mode 100644 index 78cfafb..0000000 --- a/webkit/blob/deletable_file_reference.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2011 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 "webkit/blob/deletable_file_reference.h" - -#include <map> -#include "base/file_util.h" -#include "base/file_util_proxy.h" -#include "base/lazy_instance.h" -#include "base/message_loop_proxy.h" - -namespace webkit_blob { - -namespace { - -typedef std::map<FilePath, DeletableFileReference*> DeleteableFileMap; -static base::LazyInstance<DeleteableFileMap> g_deletable_file_map = - LAZY_INSTANCE_INITIALIZER; - -} // namespace - -// static -scoped_refptr<DeletableFileReference> DeletableFileReference::Get( - const FilePath& path) { - DeleteableFileMap::iterator found = g_deletable_file_map.Get().find(path); - DeletableFileReference* reference = - (found == g_deletable_file_map.Get().end()) ? NULL : found->second; - return scoped_refptr<DeletableFileReference>(reference); -} - -// static -scoped_refptr<DeletableFileReference> DeletableFileReference::GetOrCreate( - const FilePath& path, base::MessageLoopProxy* file_thread) { - DCHECK(file_thread); - typedef std::pair<DeleteableFileMap::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 - webkit_blob::DeletableFileReference* null_reference = NULL; - InsertResult result = g_deletable_file_map.Get().insert( - DeleteableFileMap::value_type(path, null_reference)); - if (result.second == false) - return scoped_refptr<DeletableFileReference>(result.first->second); - - // Wasn't in the map, create a new reference and store the pointer. - scoped_refptr<DeletableFileReference> reference( - new DeletableFileReference(path, file_thread)); - result.first->second = reference.get(); - return reference; -} - -void DeletableFileReference::AddDeletionCallback( - const DeletionCallback& callback) { - deletion_callbacks_.push_back(callback); -} - -DeletableFileReference::DeletableFileReference( - const FilePath& path, base::MessageLoopProxy* file_thread) - : path_(path), file_thread_(file_thread) { - DCHECK(g_deletable_file_map.Get().find(path_)->second == NULL); -} - -DeletableFileReference::~DeletableFileReference() { - for (size_t i = 0; i < deletion_callbacks_.size(); i++) - deletion_callbacks_[i].Run(path_); - - DCHECK(g_deletable_file_map.Get().find(path_)->second == this); - g_deletable_file_map.Get().erase(path_); - base::FileUtilProxy::Delete(file_thread_, path_, false /* recursive */, - base::FileUtilProxy::StatusCallback()); -} - -} // namespace webkit_blob diff --git a/webkit/blob/deletable_file_reference.h b/webkit/blob/deletable_file_reference.h deleted file mode 100644 index d704de3..0000000 --- a/webkit/blob/deletable_file_reference.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2011 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. - -#ifndef WEBKIT_BLOB_DELETABLE_FILE_REFERENCE_H_ -#define WEBKIT_BLOB_DELETABLE_FILE_REFERENCE_H_ -#pragma once - -#include <vector> - -#include "base/callback.h" -#include "base/file_path.h" -#include "base/memory/ref_counted.h" -#include "webkit/blob/blob_export.h" - -namespace base { -class MessageLoopProxy; -} - -namespace webkit_blob { - -// A refcounted wrapper around a FilePath that schedules the file -// to be deleted upon final release. -class BLOB_EXPORT DeletableFileReference : - public base::RefCounted<DeletableFileReference> { - public: - typedef base::Callback<void(const FilePath&)> DeletionCallback; - - // Returns a DeletableFileReference for the given path, if no reference - // for this path exists returns NULL. - static scoped_refptr<DeletableFileReference> Get(const FilePath& path); - - // Returns a DeletableFileReference for the given path, creating a new - // reference if none yet exists. - static scoped_refptr<DeletableFileReference> GetOrCreate( - const FilePath& path, base::MessageLoopProxy* file_thread); - - // The full file path. - const FilePath& path() const { return path_; } - - void AddDeletionCallback(const DeletionCallback& callback); - - private: - friend class base::RefCounted<DeletableFileReference>; - - DeletableFileReference( - const FilePath& path, base::MessageLoopProxy* file_thread); - ~DeletableFileReference(); - - const FilePath path_; - scoped_refptr<base::MessageLoopProxy> file_thread_; - - std::vector<DeletionCallback> deletion_callbacks_; - - DISALLOW_COPY_AND_ASSIGN(DeletableFileReference); -}; - -} // namespace webkit_blob - -#endif // BASE_DELETABLE_FILE_REFERENCE_H_ diff --git a/webkit/blob/shareable_file_reference.cc b/webkit/blob/shareable_file_reference.cc new file mode 100644 index 0000000..b871624 --- /dev/null +++ b/webkit/blob/shareable_file_reference.cc @@ -0,0 +1,77 @@ +// Copyright (c) 2011 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 "webkit/blob/shareable_file_reference.h" + +#include <map> +#include "base/file_util.h" +#include "base/file_util_proxy.h" +#include "base/lazy_instance.h" +#include "base/message_loop_proxy.h" + +namespace webkit_blob { + +namespace { + +typedef std::map<FilePath, ShareableFileReference*> ShareableFileMap; +base::LazyInstance<ShareableFileMap> g_file_map = LAZY_INSTANCE_INITIALIZER; + +} // namespace + +// static +scoped_refptr<ShareableFileReference> ShareableFileReference::Get( + const FilePath& path) { + ShareableFileMap::iterator found = g_file_map.Get().find(path); + ShareableFileReference* reference = + (found == g_file_map.Get().end()) ? NULL : found->second; + return scoped_refptr<ShareableFileReference>(reference); +} + +// static +scoped_refptr<ShareableFileReference> ShareableFileReference::GetOrCreate( + const FilePath& path, FinalReleasePolicy policy, + base::MessageLoopProxy* file_thread) { + DCHECK(file_thread); + 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 + webkit_blob::ShareableFileReference* null_reference = NULL; + InsertResult result = g_file_map.Get().insert( + ShareableFileMap::value_type(path, null_reference)); + if (result.second == false) + return scoped_refptr<ShareableFileReference>(result.first->second); + + // Wasn't in the map, create a new reference and store the pointer. + scoped_refptr<ShareableFileReference> reference( + new ShareableFileReference(path, policy, file_thread)); + result.first->second = reference.get(); + return reference; +} + +void ShareableFileReference::AddFinalReleaseCallback( + const FinalReleaseCallback& callback) { + final_release_callbacks_.push_back(callback); +} + +ShareableFileReference::ShareableFileReference( + const FilePath& path, FinalReleasePolicy policy, + base::MessageLoopProxy* file_thread) + : path_(path), final_release_policy_(policy), file_thread_(file_thread) { + DCHECK(g_file_map.Get().find(path_)->second == NULL); +} + +ShareableFileReference::~ShareableFileReference() { + DCHECK(g_file_map.Get().find(path_)->second == this); + g_file_map.Get().erase(path_); + + for (size_t i = 0; i < final_release_callbacks_.size(); i++) + final_release_callbacks_[i].Run(path_); + + if (final_release_policy_ == DELETE_ON_FINAL_RELEASE) { + base::FileUtilProxy::Delete(file_thread_, path_, false /* recursive */, + base::FileUtilProxy::StatusCallback()); + } +} + +} // namespace webkit_blob diff --git a/webkit/blob/shareable_file_reference.h b/webkit/blob/shareable_file_reference.h new file mode 100644 index 0000000..8503271 --- /dev/null +++ b/webkit/blob/shareable_file_reference.h @@ -0,0 +1,77 @@ +// Copyright (c) 2011 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. + +#ifndef WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ +#define WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ +#pragma once + +#include <vector> + +#include "base/callback.h" +#include "base/file_path.h" +#include "base/memory/ref_counted.h" +#include "webkit/blob/blob_export.h" + +namespace base { +class MessageLoopProxy; +} + +namespace webkit_blob { + +// A refcounted wrapper around a FilePath that can optionally schedule +// the file to be deleted upon final release and/or to notify a consumer +// when final release occurs. This class is single-threaded and should +// only be invoked on the IO thread in chrome. +class BLOB_EXPORT ShareableFileReference + : public base::RefCounted<ShareableFileReference> { + public: + typedef base::Callback<void(const FilePath&)> FinalReleaseCallback; + + enum FinalReleasePolicy { + DELETE_ON_FINAL_RELEASE, + DONT_DELETE_ON_FINAL_RELEASE, + }; + + // Returns a ShareableFileReference for the given path, if no reference + // for this path exists returns NULL. + static scoped_refptr<ShareableFileReference> Get(const FilePath& path); + + // Returns a ShareableFileReference for the given path, creating a new + // reference if none yet exists. If there's a pre-existing reference for + // the path, the deletable parameter of this method is ignored. + static scoped_refptr<ShareableFileReference> GetOrCreate( + const FilePath& path, + FinalReleasePolicy policy, + base::MessageLoopProxy* file_thread); + + // The full file path. + const FilePath& path() const { return path_; } + + // Whether it's to be deleted on final release. + FinalReleasePolicy final_release_policy() const { + return final_release_policy_; + } + + void AddFinalReleaseCallback(const FinalReleaseCallback& callback); + + private: + friend class base::RefCounted<ShareableFileReference>; + + ShareableFileReference( + const FilePath& path, + FinalReleasePolicy policy, + base::MessageLoopProxy* file_thread); + ~ShareableFileReference(); + + const FilePath path_; + const FinalReleasePolicy final_release_policy_; + const scoped_refptr<base::MessageLoopProxy> file_thread_; + std::vector<FinalReleaseCallback> final_release_callbacks_; + + DISALLOW_COPY_AND_ASSIGN(ShareableFileReference); +}; + +} // namespace webkit_blob + +#endif // WEBKIT_BLOB_SHAREABLE_FILE_REFERENCE_H_ diff --git a/webkit/blob/deletable_file_reference_unittest.cc b/webkit/blob/shareable_file_reference_unittest.cc index d7c1d83..966a3a6 100644 --- a/webkit/blob/deletable_file_reference_unittest.cc +++ b/webkit/blob/shareable_file_reference_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/blob/deletable_file_reference.h" +#include "webkit/blob/shareable_file_reference.h" #include "base/file_util.h" #include "base/message_loop.h" @@ -12,7 +12,7 @@ namespace webkit_blob { -TEST(DeletableFileReferenceTest, TestReferences) { +TEST(ShareableFileReferenceTest, TestReferences) { scoped_refptr<base::MessageLoopProxy> loop_proxy = base::MessageLoopProxy::current(); ScopedTempDir temp_dir; @@ -24,31 +24,35 @@ TEST(DeletableFileReferenceTest, TestReferences) { EXPECT_TRUE(file_util::PathExists(file)); // Create a first reference to that file. - scoped_refptr<DeletableFileReference> reference1; - reference1 = DeletableFileReference::Get(file); + scoped_refptr<ShareableFileReference> reference1; + reference1 = ShareableFileReference::Get(file); EXPECT_FALSE(reference1.get()); - reference1 = DeletableFileReference::GetOrCreate(file, loop_proxy); + reference1 = ShareableFileReference::GetOrCreate( + file, ShareableFileReference::DELETE_ON_FINAL_RELEASE, loop_proxy); EXPECT_TRUE(reference1.get()); EXPECT_TRUE(file == reference1->path()); // Get a second reference to that file. - scoped_refptr<DeletableFileReference> reference2; - reference2 = DeletableFileReference::Get(file); + scoped_refptr<ShareableFileReference> reference2; + reference2 = ShareableFileReference::Get(file); EXPECT_EQ(reference1.get(), reference2.get()); - reference2 = DeletableFileReference::GetOrCreate(file, loop_proxy); + reference2 = ShareableFileReference::GetOrCreate( + file, ShareableFileReference::DELETE_ON_FINAL_RELEASE, loop_proxy); EXPECT_EQ(reference1.get(), reference2.get()); // Drop the first reference, the file and reference should still be there. reference1 = NULL; - EXPECT_TRUE(DeletableFileReference::Get(file).get()); + EXPECT_TRUE(ShareableFileReference::Get(file).get()); MessageLoop::current()->RunAllPending(); EXPECT_TRUE(file_util::PathExists(file)); // Drop the second reference, the file and reference should get deleted. reference2 = NULL; - EXPECT_FALSE(DeletableFileReference::Get(file).get()); + EXPECT_FALSE(ShareableFileReference::Get(file).get()); MessageLoop::current()->RunAllPending(); EXPECT_FALSE(file_util::PathExists(file)); + + // TODO(michaeln): add a test for files that aren't deletable behavior. } } // namespace webkit_blob diff --git a/webkit/blob/webkit_blob.gypi b/webkit/blob/webkit_blob.gypi index eb5ec2c..bb07019 100644 --- a/webkit/blob/webkit_blob.gypi +++ b/webkit/blob/webkit_blob.gypi @@ -37,8 +37,8 @@ 'blob_url_request_job.h', 'blob_url_request_job_factory.cc', 'blob_url_request_job_factory.h', - 'deletable_file_reference.cc', - 'deletable_file_reference.h', + 'shareable_file_reference.cc', + 'shareable_file_reference.h', 'view_blob_internals_job.cc', 'view_blob_internals_job.h', ], diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index 1a36255..67d33a6 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -9,7 +9,7 @@ #include "base/utf_string_conversions.h" #include "net/base/escape.h" #include "net/url_request/url_request_context.h" -#include "webkit/blob/deletable_file_reference.h" +#include "webkit/blob/shareable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util_proxy.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -31,7 +31,7 @@ void GetMetadataForSnapshot( const base::PlatformFileInfo& file_info, const FilePath& platform_path) { // We don't want the third party to delete our local file, so just returning - // NULL as |deletable_file_reference|. + // NULL as |file_reference|. callback.Run(result, file_info, platform_path, NULL); } diff --git a/webkit/fileapi/file_system_operation_interface.h b/webkit/fileapi/file_system_operation_interface.h index 6777f34..163f402 100644 --- a/webkit/fileapi/file_system_operation_interface.h +++ b/webkit/fileapi/file_system_operation_interface.h @@ -8,7 +8,7 @@ #include "base/file_util_proxy.h" #include "base/platform_file.h" #include "base/process.h" -#include "webkit/blob/deletable_file_reference.h" +#include "webkit/blob/shareable_file_reference.h" namespace base { class Time; @@ -20,7 +20,7 @@ class URLRequestContext; } // namespace net namespace webkit_blob { -class DeletableFileReference; +class ShareableFileReference; } class GURL; @@ -90,22 +90,21 @@ class FileSystemOperationInterface { // may want to download the file into a temporary snapshot file and then // return the metadata of the temporary file. // - // |deletable_file_ref| is used to manage the lifetime of the returned + // |file_ref| is used to manage the lifetime of the returned // snapshot file. It can be set to let the chromium backend take // care of the life time of the snapshot file. Otherwise (if the returned - // file is not a temporary file to be deleted) the implementation can just + // file does not require any handling) the implementation can just // return NULL. In a more complex case, the implementaiton can manage // the lifetime of the snapshot file on its own (e.g. by its cache system) // but also can be notified via the reference when the file becomes no // longer necessary in the javascript world. - // Please see the comment for DeletableFileReference for details. + // Please see the comment for ShareableFileReference for details. // typedef base::Callback<void( base::PlatformFileError result, const base::PlatformFileInfo& file_info, const FilePath& platform_path, - const scoped_refptr<webkit_blob::DeletableFileReference>& - deletable_file_ref + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref )> SnapshotFileCallback; // Used for Write(). diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index dcd0238..aa97fb3 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -13,7 +13,7 @@ #include "base/scoped_temp_dir.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/blob/deletable_file_reference.h" +#include "webkit/blob/shareable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -29,7 +29,7 @@ using quota::QuotaClient; using quota::QuotaManager; using quota::QuotaManagerProxy; using quota::StorageType; -using webkit_blob::DeletableFileReference; +using webkit_blob::ShareableFileReference; namespace fileapi { @@ -170,8 +170,8 @@ class FileSystemOperationTest const std::vector<base::FileUtilProxy::Entry>& entries() const { return entries_; } - const DeletableFileReference* deletable_file_ref() const { - return deletable_file_ref_; + const ShareableFileReference* shareable_file_ref() const { + return shareable_file_ref_; } virtual void SetUp(); @@ -286,11 +286,11 @@ class FileSystemOperationTest base::PlatformFileError status, const base::PlatformFileInfo& info, const FilePath& platform_path, - const scoped_refptr<DeletableFileReference>& deletable_file_ref) { + const scoped_refptr<ShareableFileReference>& shareable_file_ref) { info_ = info; path_ = platform_path; status_ = status; - deletable_file_ref_ = deletable_file_ref; + shareable_file_ref_ = shareable_file_ref; } // For post-operation status. @@ -298,7 +298,7 @@ class FileSystemOperationTest base::PlatformFileInfo info_; FilePath path_; std::vector<base::FileUtilProxy::Entry> entries_; - scoped_refptr<DeletableFileReference> deletable_file_ref_; + scoped_refptr<ShareableFileReference> shareable_file_ref_; private: scoped_ptr<LocalFileUtil> local_file_util_; @@ -1059,9 +1059,9 @@ TEST_F(FileSystemOperationTest, TestCreateSnapshotFile) { EXPECT_FALSE(info().is_directory); EXPECT_EQ(PlatformPath(file_path), path()); - // The FileSystemOpration implementation does not set the deletable - // file reference. - EXPECT_EQ(NULL, deletable_file_ref()); + // The FileSystemOpration implementation does not create a + // shareable file reference. + EXPECT_EQ(NULL, shareable_file_ref()); } } // namespace fileapi diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc index e7b271d..4034587 100644 --- a/webkit/tools/test_shell/simple_file_system.cc +++ b/webkit/tools/test_shell/simple_file_system.cc @@ -152,7 +152,7 @@ void SimpleFileSystem::createSnapshotFileAndReadMetadata( const WebURL& blobURL, const WebURL& path, WebFileSystemCallbacks* callbacks) { - // Not registering blobURL for this simplified version. + // TODO(michaeln): Register the blobURL with the blob storage contoller. GetNewOperation(path)->CreateSnapshotFile( path, SnapshotFileHandler(callbacks)); } @@ -260,6 +260,6 @@ void SimpleFileSystem::DidCreateSnapshotFile( base::PlatformFileError result, const base::PlatformFileInfo& info, const FilePath& platform_path, - const scoped_refptr<webkit_blob::DeletableFileReference>& deletable_ref) { + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { DidGetMetadata(callbacks, result, info, platform_path); } diff --git a/webkit/tools/test_shell/simple_file_system.h b/webkit/tools/test_shell/simple_file_system.h index c9421dd..85533a1 100644 --- a/webkit/tools/test_shell/simple_file_system.h +++ b/webkit/tools/test_shell/simple_file_system.h @@ -119,7 +119,7 @@ class SimpleFileSystem base::PlatformFileError result, const base::PlatformFileInfo& info, const FilePath& platform_path, - const scoped_refptr<webkit_blob::DeletableFileReference>& deletable_ref); + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); // A temporary directory for FileSystem API. ScopedTempDir file_system_dir_; diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 9a2c80b..1023794 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -62,7 +62,7 @@ #include "webkit/appcache/appcache_interfaces.h" #include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/blob_url_request_job.h" -#include "webkit/blob/deletable_file_reference.h" +#include "webkit/blob/shareable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_dir_url_request_job.h" #include "webkit/fileapi/file_system_url_request_job.h" @@ -81,7 +81,7 @@ using webkit_glue::ResourceLoaderBridge; using webkit_glue::ResourceResponseInfo; using net::StaticCookiePolicy; using net::HttpResponseHeaders; -using webkit_blob::DeletableFileReference; +using webkit_blob::ShareableFileReference; namespace { @@ -330,8 +330,9 @@ class RequestProxy : public net::URLRequest::Delegate, if (download_to_file_) { FilePath path; if (file_util::CreateTemporaryFile(&path)) { - downloaded_file_ = DeletableFileReference::GetOrCreate( - path, base::MessageLoopProxy::current()); + downloaded_file_ = ShareableFileReference::GetOrCreate( + path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, + base::MessageLoopProxy::current()); file_stream_.OpenSync( path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); } @@ -660,7 +661,7 @@ class RequestProxy : public net::URLRequest::Delegate, // Support for request.download_to_file behavior. bool download_to_file_; net::FileStream file_stream_; - scoped_refptr<DeletableFileReference> downloaded_file_; + scoped_refptr<ShareableFileReference> downloaded_file_; // Size of our async IO data buffers static const int kDataSize = 16*1024; diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index 6f49b9b..7baf7ec 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -397,7 +397,7 @@ '../../appcache/mock_appcache_storage_unittest.cc', '../../blob/blob_storage_controller_unittest.cc', '../../blob/blob_url_request_job_unittest.cc', - '../../blob/deletable_file_reference_unittest.cc', + '../../blob/shareable_file_reference_unittest.cc', '../../database/database_connections_unittest.cc', '../../database/database_quota_client_unittest.cc', '../../database/databases_table_unittest.cc', |