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

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

Issue 14472008: [FileAPI] Add file open ID and close callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (!ChildThread::current()->Send( 240 if (!ChildThread::current()->Send(
241 new FileSystemHostMsg_OpenFile( 241 new FileSystemHostMsg_OpenFile(
242 request_id, file_path, file_flags))) { 242 request_id, file_path, file_flags))) {
243 dispatchers_.Remove(request_id); // destroys |dispatcher| 243 dispatchers_.Remove(request_id); // destroys |dispatcher|
244 return false; 244 return false;
245 } 245 }
246 246
247 return true; 247 return true;
248 } 248 }
249 249
250 bool FileSystemDispatcher::NotifyCloseFile(const GURL& file_path) { 250 bool FileSystemDispatcher::NotifyCloseFile(int file_open_id) {
251 return ChildThread::current()->Send( 251 return ChildThread::current()->Send(
252 new FileSystemHostMsg_NotifyCloseFile(file_path)); 252 new FileSystemHostMsg_NotifyCloseFile(file_open_id));
253 } 253 }
254 254
255 bool FileSystemDispatcher::CreateSnapshotFile( 255 bool FileSystemDispatcher::CreateSnapshotFile(
256 const GURL& file_path, 256 const GURL& file_path,
257 fileapi::FileSystemCallbackDispatcher* dispatcher) { 257 fileapi::FileSystemCallbackDispatcher* dispatcher) {
258 int request_id = dispatchers_.Add(dispatcher); 258 int request_id = dispatchers_.Add(dispatcher);
259 if (!ChildThread::current()->Send( 259 if (!ChildThread::current()->Send(
260 new FileSystemHostMsg_CreateSnapshotFile( 260 new FileSystemHostMsg_CreateSnapshotFile(
261 request_id, file_path))) { 261 request_id, file_path))) {
262 dispatchers_.Remove(request_id); // destroys |dispatcher| 262 dispatchers_.Remove(request_id); // destroys |dispatcher|
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 dispatchers_.Lookup(request_id); 332 dispatchers_.Lookup(request_id);
333 DCHECK(dispatcher); 333 DCHECK(dispatcher);
334 dispatcher->DidWrite(bytes, complete); 334 dispatcher->DidWrite(bytes, complete);
335 if (complete) 335 if (complete)
336 dispatchers_.Remove(request_id); 336 dispatchers_.Remove(request_id);
337 } 337 }
338 338
339 void FileSystemDispatcher::OnDidOpenFile( 339 void FileSystemDispatcher::OnDidOpenFile(
340 int request_id, 340 int request_id,
341 IPC::PlatformFileForTransit file, 341 IPC::PlatformFileForTransit file,
342 int file_open_id,
342 quota::QuotaLimitType quota_policy) { 343 quota::QuotaLimitType quota_policy) {
343 fileapi::FileSystemCallbackDispatcher* dispatcher = 344 fileapi::FileSystemCallbackDispatcher* dispatcher =
344 dispatchers_.Lookup(request_id); 345 dispatchers_.Lookup(request_id);
345 DCHECK(dispatcher); 346 DCHECK(dispatcher);
346 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), 347 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file),
348 file_open_id,
347 quota_policy); 349 quota_policy);
348 dispatchers_.Remove(request_id); 350 dispatchers_.Remove(request_id);
349 } 351 }
350 352
351 } // namespace content 353 } // 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