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

Side by Side Diff: ppapi/proxy/file_io_resource.cc

Issue 130053003: [Pepper] Wire up append mode writing support of FileIO (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 "ppapi/proxy/file_io_resource.h" 5 #include "ppapi/proxy/file_io_resource.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/task_runner_util.h" 8 #include "base/task_runner_util.h"
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 called_close_ = true; 397 called_close_ = true;
398 if (check_quota_) { 398 if (check_quota_) {
399 check_quota_ = false; 399 check_quota_ = false;
400 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile( 400 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile(
401 pp_resource()); 401 pp_resource());
402 } 402 }
403 403
404 if (file_handle_) 404 if (file_handle_)
405 file_handle_ = NULL; 405 file_handle_ = NULL;
406 406
407 // TODO(tzik): Post |max_written_offset_| and |append_mode_write_amount_|
408 // separately by using FileGrowth after the IPC signature changed.
409 Post(BROWSER, PpapiHostMsg_FileIO_Close( 407 Post(BROWSER, PpapiHostMsg_FileIO_Close(
410 max_written_offset_ + append_mode_write_amount_)); 408 FileGrowth(max_written_offset_, append_mode_write_amount_)));
411 } 409 }
412 410
413 int32_t FileIOResource::RequestOSFileHandle( 411 int32_t FileIOResource::RequestOSFileHandle(
414 PP_FileHandle* handle, 412 PP_FileHandle* handle,
415 scoped_refptr<TrackedCallback> callback) { 413 scoped_refptr<TrackedCallback> callback) {
416 int32_t rv = state_manager_.CheckOperationState( 414 int32_t rv = state_manager_.CheckOperationState(
417 FileIOStateManager::OPERATION_EXCLUSIVE, true); 415 FileIOStateManager::OPERATION_EXCLUSIVE, true);
418 if (rv != PP_OK) 416 if (rv != PP_OK)
419 return rv; 417 return rv;
420 418
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); 701 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file);
704 702
705 // End this operation now, so the user's callback can execute another FileIO 703 // End this operation now, so the user's callback can execute another FileIO
706 // operation, assuming there are no other pending operations. 704 // operation, assuming there are no other pending operations.
707 state_manager_.SetOperationFinished(); 705 state_manager_.SetOperationFinished();
708 callback->Run(result); 706 callback->Run(result);
709 } 707 }
710 708
711 } // namespace proxy 709 } // namespace proxy
712 } // namespace ppapi 710 } // namespace ppapi
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/quota_reservation.cc ('k') | ppapi/proxy/file_system_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698