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

Side by Side Diff: webkit/fileapi/file_system_file_util_proxy.cc

Issue 10834167: Create ShareableFileReference on IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding unknown policy for DCHECK Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.h ('k') | webkit/fileapi/file_util_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/fileapi/file_system_file_util_proxy.h" 5 #include "webkit/fileapi/file_system_file_util_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "webkit/fileapi/file_system_context.h" 10 #include "webkit/fileapi/file_system_context.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 private: 42 private:
43 base::PlatformFileError error_; 43 base::PlatformFileError error_;
44 bool created_; 44 bool created_;
45 DISALLOW_COPY_AND_ASSIGN(EnsureFileExistsHelper); 45 DISALLOW_COPY_AND_ASSIGN(EnsureFileExistsHelper);
46 }; 46 };
47 47
48 class GetFileInfoHelper { 48 class GetFileInfoHelper {
49 public: 49 public:
50 GetFileInfoHelper() : error_(base::PLATFORM_FILE_OK) {} 50 GetFileInfoHelper()
51 : error_(base::PLATFORM_FILE_OK),
52 snapshot_policy_(FileSystemFileUtil::kSnapshotFileUnknown) {}
51 53
52 void GetFileInfo(FileSystemFileUtil* file_util, 54 void GetFileInfo(FileSystemFileUtil* file_util,
53 FileSystemOperationContext* context, 55 FileSystemOperationContext* context,
54 const FileSystemURL& url) { 56 const FileSystemURL& url) {
55 error_ = file_util->GetFileInfo(context, url, &file_info_, &platform_path_); 57 error_ = file_util->GetFileInfo(context, url, &file_info_, &platform_path_);
56 } 58 }
57 59
58 void CreateSnapshotFile(FileSystemFileUtil* file_util, 60 void CreateSnapshotFile(FileSystemFileUtil* file_util,
59 FileSystemOperationContext* context, 61 FileSystemOperationContext* context,
60 const FileSystemURL& url) { 62 const FileSystemURL& url) {
61 file_ref_ = file_util->CreateSnapshotFile( 63 error_ = file_util->CreateSnapshotFile(
62 context, url, &error_, &file_info_, &platform_path_); 64 context, url, &file_info_, &platform_path_, &snapshot_policy_);
63 } 65 }
64 66
65 void ReplyFileInfo(const Proxy::GetFileInfoCallback& callback) { 67 void ReplyFileInfo(const Proxy::GetFileInfoCallback& callback) {
66 if (!callback.is_null()) 68 if (!callback.is_null())
67 callback.Run(error_, file_info_, platform_path_); 69 callback.Run(error_, file_info_, platform_path_);
68 } 70 }
69 71
70 void ReplySnapshotFile(const Proxy::SnapshotFileCallback& callback) { 72 void ReplySnapshotFile(const Proxy::SnapshotFileCallback& callback) {
73 DCHECK(snapshot_policy_ != FileSystemFileUtil::kSnapshotFileUnknown);
71 if (!callback.is_null()) 74 if (!callback.is_null())
72 callback.Run(error_, file_info_, platform_path_, file_ref_); 75 callback.Run(error_, file_info_, platform_path_, snapshot_policy_);
73 } 76 }
74 77
75 private: 78 private:
76 base::PlatformFileError error_; 79 base::PlatformFileError error_;
77 base::PlatformFileInfo file_info_; 80 base::PlatformFileInfo file_info_;
78 FilePath platform_path_; 81 FilePath platform_path_;
79 scoped_refptr<webkit_blob::ShareableFileReference> file_ref_; 82 FileSystemFileUtil::SnapshotFilePolicy snapshot_policy_;
80 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); 83 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
81 }; 84 };
82 85
83 class ReadDirectoryHelper { 86 class ReadDirectoryHelper {
84 public: 87 public:
85 ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {} 88 ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {}
86 89
87 void RunWork(FileSystemFileUtil* file_util, 90 void RunWork(FileSystemFileUtil* file_util,
88 FileSystemOperationContext* context, 91 FileSystemOperationContext* context,
89 const FileSystemURL& url) { 92 const FileSystemURL& url) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int64 length, 259 int64 length,
257 const StatusCallback& callback) { 260 const StatusCallback& callback) {
258 return base::FileUtilProxy::RelayFileTask( 261 return base::FileUtilProxy::RelayFileTask(
259 context->file_task_runner(), FROM_HERE, 262 context->file_task_runner(), FROM_HERE,
260 Bind(&FileSystemFileUtil::Truncate, Unretained(file_util), 263 Bind(&FileSystemFileUtil::Truncate, Unretained(file_util),
261 context, url, length), 264 context, url, length),
262 callback); 265 callback);
263 } 266 }
264 267
265 } // namespace fileapi 268 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.h ('k') | webkit/fileapi/file_util_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698