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

Side by Side Diff: content/common/fileapi/file_system_dispatcher.cc

Issue 12084077: FileSystem mods: Changes to snapshot file creation to remove dependencies on blobs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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
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 "content/common/fileapi/file_system_dispatcher.h" 5 #include "content/common/fileapi/file_system_dispatcher.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/process.h" 8 #include "base/process.h"
9 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
10 #include "content/common/fileapi/file_system_messages.h" 10 #include "content/common/fileapi/file_system_messages.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 return true; 245 return true;
246 } 246 }
247 247
248 bool FileSystemDispatcher::NotifyCloseFile(const GURL& file_path) { 248 bool FileSystemDispatcher::NotifyCloseFile(const GURL& file_path) {
249 return ChildThread::current()->Send( 249 return ChildThread::current()->Send(
250 new FileSystemHostMsg_NotifyCloseFile(file_path)); 250 new FileSystemHostMsg_NotifyCloseFile(file_path));
251 } 251 }
252 252
253 bool FileSystemDispatcher::CreateSnapshotFile( 253 bool FileSystemDispatcher::CreateSnapshotFile(
254 const GURL& file_path,
255 fileapi::FileSystemCallbackDispatcher* dispatcher) {
256 int request_id = dispatchers_.Add(dispatcher);
257 if (!ChildThread::current()->Send(
258 new FileSystemHostMsg_CreateSnapshotFile(
259 request_id, file_path))) {
260 dispatchers_.Remove(request_id); // destroys |dispatcher|
261 return false;
262 }
263 return true;
264 }
265
266 bool FileSystemDispatcher::CreateSnapshotFile_Deprecated(
254 const GURL& blob_url, 267 const GURL& blob_url,
255 const GURL& file_path, 268 const GURL& file_path,
256 fileapi::FileSystemCallbackDispatcher* dispatcher) { 269 fileapi::FileSystemCallbackDispatcher* dispatcher) {
257 int request_id = dispatchers_.Add(dispatcher); 270 int request_id = dispatchers_.Add(dispatcher);
258 if (!ChildThread::current()->Send( 271 if (!ChildThread::current()->Send(
259 new FileSystemHostMsg_CreateSnapshotFile( 272 new FileSystemHostMsg_CreateSnapshotFile_Deprecated(
260 request_id, blob_url, file_path))) { 273 request_id, blob_url, file_path))) {
261 dispatchers_.Remove(request_id); // destroys |dispatcher| 274 dispatchers_.Remove(request_id); // destroys |dispatcher|
262 return false; 275 return false;
263 } 276 }
264 return true; 277 return true;
265 } 278 }
266 279
267 void FileSystemDispatcher::OnDidOpenFileSystem(int request_id, 280 void FileSystemDispatcher::OnDidOpenFileSystem(int request_id,
268 const std::string& name, 281 const std::string& name,
269 const GURL& root) { 282 const GURL& root) {
(...skipping 16 matching lines...) Expand all
286 void FileSystemDispatcher::OnDidReadMetadata( 299 void FileSystemDispatcher::OnDidReadMetadata(
287 int request_id, const base::PlatformFileInfo& file_info, 300 int request_id, const base::PlatformFileInfo& file_info,
288 const base::FilePath& platform_path) { 301 const base::FilePath& platform_path) {
289 fileapi::FileSystemCallbackDispatcher* dispatcher = 302 fileapi::FileSystemCallbackDispatcher* dispatcher =
290 dispatchers_.Lookup(request_id); 303 dispatchers_.Lookup(request_id);
291 DCHECK(dispatcher); 304 DCHECK(dispatcher);
292 dispatcher->DidReadMetadata(file_info, platform_path); 305 dispatcher->DidReadMetadata(file_info, platform_path);
293 dispatchers_.Remove(request_id); 306 dispatchers_.Remove(request_id);
294 } 307 }
295 308
309 void FileSystemDispatcher::OnDidCreateSnapshotFile(
310 int request_id, const base::PlatformFileInfo& file_info,
311 const base::FilePath& platform_path) {
312 fileapi::FileSystemCallbackDispatcher* dispatcher =
313 dispatchers_.Lookup(request_id);
314 DCHECK(dispatcher);
315 dispatcher->DidCreateSnapshotFile(file_info, platform_path);
316 dispatchers_.Remove(request_id);
317 ChildThread::current()->Send(
318 new FileSystemHostMsg_DidReceiveSnapshotFile(request_id));
319 }
320
296 void FileSystemDispatcher::OnDidReadDirectory( 321 void FileSystemDispatcher::OnDidReadDirectory(
297 int request_id, 322 int request_id,
298 const std::vector<base::FileUtilProxy::Entry>& entries, 323 const std::vector<base::FileUtilProxy::Entry>& entries,
299 bool has_more) { 324 bool has_more) {
300 fileapi::FileSystemCallbackDispatcher* dispatcher = 325 fileapi::FileSystemCallbackDispatcher* dispatcher =
301 dispatchers_.Lookup(request_id); 326 dispatchers_.Lookup(request_id);
302 DCHECK(dispatcher); 327 DCHECK(dispatcher);
303 dispatcher->DidReadDirectory(entries, has_more); 328 dispatcher->DidReadDirectory(entries, has_more);
304 dispatchers_.Remove(request_id); 329 dispatchers_.Remove(request_id);
305 } 330 }
(...skipping 20 matching lines...) Expand all
326 void FileSystemDispatcher::OnDidOpenFile( 351 void FileSystemDispatcher::OnDidOpenFile(
327 int request_id, IPC::PlatformFileForTransit file) { 352 int request_id, IPC::PlatformFileForTransit file) {
328 fileapi::FileSystemCallbackDispatcher* dispatcher = 353 fileapi::FileSystemCallbackDispatcher* dispatcher =
329 dispatchers_.Lookup(request_id); 354 dispatchers_.Lookup(request_id);
330 DCHECK(dispatcher); 355 DCHECK(dispatcher);
331 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); 356 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file));
332 dispatchers_.Remove(request_id); 357 dispatchers_.Remove(request_id);
333 } 358 }
334 359
335 } // namespace content 360 } // namespace content
OLDNEW
« no previous file with comments | « content/common/fileapi/file_system_dispatcher.h ('k') | content/common/fileapi/file_system_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698