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

Side by Side Diff: trunk/src/content/child/fileapi/file_system_dispatcher.cc

Issue 21008006: Revert 214599 "Revert 214160 "Implement Worker-MainThread bridge..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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
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/child/fileapi/file_system_dispatcher.h" 5 #include "content/child/fileapi/file_system_dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/process/process.h" 10 #include "base/process/process.h"
10 #include "content/child/child_thread.h" 11 #include "content/child/child_thread.h"
11 #include "content/common/fileapi/file_system_messages.h" 12 #include "content/common/fileapi/file_system_messages.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 class FileSystemDispatcher::CallbackDispatcher { 16 class FileSystemDispatcher::CallbackDispatcher {
16 public: 17 public:
17 typedef CallbackDispatcher self; 18 typedef CallbackDispatcher self;
18 typedef FileSystemDispatcher::StatusCallback StatusCallback; 19 typedef FileSystemDispatcher::StatusCallback StatusCallback;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 error_callback_.Run(error_code); 82 error_callback_.Run(error_code);
82 } 83 }
83 84
84 void DidReadMetadata( 85 void DidReadMetadata(
85 const base::PlatformFileInfo& file_info) { 86 const base::PlatformFileInfo& file_info) {
86 metadata_callback_.Run(file_info); 87 metadata_callback_.Run(file_info);
87 } 88 }
88 89
89 void DidCreateSnapshotFile( 90 void DidCreateSnapshotFile(
90 const base::PlatformFileInfo& file_info, 91 const base::PlatformFileInfo& file_info,
91 const base::FilePath& platform_path) { 92 const base::FilePath& platform_path,
92 snapshot_callback_.Run(file_info, platform_path); 93 int request_id) {
94 snapshot_callback_.Run(file_info, platform_path, request_id);
93 } 95 }
94 96
95 void DidReadDirectory( 97 void DidReadDirectory(
96 const std::vector<fileapi::DirectoryEntry>& entries, 98 const std::vector<fileapi::DirectoryEntry>& entries,
97 bool has_more) { 99 bool has_more) {
98 directory_callback_.Run(entries, has_more); 100 directory_callback_.Run(entries, has_more);
99 } 101 }
100 102
101 void DidOpenFileSystem(const std::string& name, 103 void DidOpenFileSystem(const std::string& name,
102 const GURL& root) { 104 const GURL& root) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 DCHECK(dispatcher); 358 DCHECK(dispatcher);
357 dispatcher->DidReadMetadata(file_info); 359 dispatcher->DidReadMetadata(file_info);
358 dispatchers_.Remove(request_id); 360 dispatchers_.Remove(request_id);
359 } 361 }
360 362
361 void FileSystemDispatcher::OnDidCreateSnapshotFile( 363 void FileSystemDispatcher::OnDidCreateSnapshotFile(
362 int request_id, const base::PlatformFileInfo& file_info, 364 int request_id, const base::PlatformFileInfo& file_info,
363 const base::FilePath& platform_path) { 365 const base::FilePath& platform_path) {
364 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); 366 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
365 DCHECK(dispatcher); 367 DCHECK(dispatcher);
366 dispatcher->DidCreateSnapshotFile(file_info, platform_path); 368 dispatcher->DidCreateSnapshotFile(file_info, platform_path, request_id);
367 dispatchers_.Remove(request_id); 369 dispatchers_.Remove(request_id);
368 ChildThread::current()->Send(
369 new FileSystemHostMsg_DidReceiveSnapshotFile(request_id));
370 } 370 }
371 371
372 void FileSystemDispatcher::OnDidReadDirectory( 372 void FileSystemDispatcher::OnDidReadDirectory(
373 int request_id, 373 int request_id,
374 const std::vector<fileapi::DirectoryEntry>& entries, 374 const std::vector<fileapi::DirectoryEntry>& entries,
375 bool has_more) { 375 bool has_more) {
376 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); 376 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
377 DCHECK(dispatcher); 377 DCHECK(dispatcher);
378 dispatcher->DidReadDirectory(entries, has_more); 378 dispatcher->DidReadDirectory(entries, has_more);
379 dispatchers_.Remove(request_id); 379 dispatchers_.Remove(request_id);
(...skipping 23 matching lines...) Expand all
403 quota::QuotaLimitType quota_policy) { 403 quota::QuotaLimitType quota_policy) {
404 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); 404 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
405 DCHECK(dispatcher); 405 DCHECK(dispatcher);
406 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), 406 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file),
407 file_open_id, 407 file_open_id,
408 quota_policy); 408 quota_policy);
409 dispatchers_.Remove(request_id); 409 dispatchers_.Remove(request_id);
410 } 410 }
411 411
412 } // namespace content 412 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698