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

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: Created 6 years, 11 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 called_close_ = true; 391 called_close_ = true;
392 if (check_quota_) { 392 if (check_quota_) {
393 check_quota_ = false; 393 check_quota_ = false;
394 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile( 394 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile(
395 pp_resource()); 395 pp_resource());
396 } 396 }
397 397
398 if (file_handle_) 398 if (file_handle_)
399 file_handle_ = NULL; 399 file_handle_ = NULL;
400 400
401 // TODO(tzik): Post |max_written_offset_| and |append_mode_write_amount_|
402 // separately by using FileGrowth after the IPC signature changed.
403 Post(BROWSER, PpapiHostMsg_FileIO_Close( 401 Post(BROWSER, PpapiHostMsg_FileIO_Close(
404 max_written_offset_ + append_mode_write_amount_)); 402 FileGrowth(max_written_offset_, append_mode_write_amount_)));
405 } 403 }
406 404
407 int32_t FileIOResource::RequestOSFileHandle( 405 int32_t FileIOResource::RequestOSFileHandle(
408 PP_FileHandle* handle, 406 PP_FileHandle* handle,
409 scoped_refptr<TrackedCallback> callback) { 407 scoped_refptr<TrackedCallback> callback) {
410 int32_t rv = state_manager_.CheckOperationState( 408 int32_t rv = state_manager_.CheckOperationState(
411 FileIOStateManager::OPERATION_EXCLUSIVE, true); 409 FileIOStateManager::OPERATION_EXCLUSIVE, true);
412 if (rv != PP_OK) 410 if (rv != PP_OK)
413 return rv; 411 return rv;
414 412
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); 692 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file);
695 693
696 // End this operation now, so the user's callback can execute another FileIO 694 // End this operation now, so the user's callback can execute another FileIO
697 // operation, assuming there are no other pending operations. 695 // operation, assuming there are no other pending operations.
698 state_manager_.SetOperationFinished(); 696 state_manager_.SetOperationFinished();
699 callback->Run(result); 697 callback->Run(result);
700 } 698 }
701 699
702 } // namespace proxy 700 } // namespace proxy
703 } // namespace ppapi 701 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698