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/browser/renderer_host/pepper/pepper_file_io_host.cc

Issue 130053003: [Pepper] Wire up append mode writing support of FileIO (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/max_written_offsets/file_sizes/g 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/renderer_host/pepper/pepper_file_io_host.h" 5 #include "content/browser/renderer_host/pepper/pepper_file_io_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_util_proxy.h" 10 #include "base/files/file_util_proxy.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 weak_factory_.GetWeakPtr(), 327 weak_factory_.GetWeakPtr(),
328 context->MakeReplyMessageContext()))) 328 context->MakeReplyMessageContext())))
329 return PP_ERROR_FAILED; 329 return PP_ERROR_FAILED;
330 330
331 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); 331 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
332 return PP_OK_COMPLETIONPENDING; 332 return PP_OK_COMPLETIONPENDING;
333 } 333 }
334 334
335 int32_t PepperFileIOHost::OnHostMsgClose( 335 int32_t PepperFileIOHost::OnHostMsgClose(
336 ppapi::host::HostMessageContext* context, 336 ppapi::host::HostMessageContext* context,
337 int64_t max_written_offset) { 337 const ppapi::FileGrowth& file_growth) {
338 if (check_quota_) { 338 if (check_quota_) {
339 file_system_host_->CloseQuotaFile( 339 file_system_host_->CloseQuotaFile(this, file_growth);
340 this,
341 ppapi::FileGrowth(max_written_offset, 0));
342 check_quota_ = false; 340 check_quota_ = false;
343 } 341 }
344 342
345 if (file_ != base::kInvalidPlatformFileValue) { 343 if (file_ != base::kInvalidPlatformFileValue) {
346 base::FileUtilProxy::Close( 344 base::FileUtilProxy::Close(
347 file_message_loop_, 345 file_message_loop_,
348 file_, 346 file_,
349 base::Bind(&PepperFileIOHost::DidCloseFile, 347 base::Bind(&PepperFileIOHost::DidCloseFile,
350 weak_factory_.GetWeakPtr())); 348 weak_factory_.GetWeakPtr()));
351 file_ = base::kInvalidPlatformFileValue; 349 file_ = base::kInvalidPlatformFileValue;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 462
465 ppapi::proxy::SerializedHandle file_handle; 463 ppapi::proxy::SerializedHandle file_handle;
466 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. 464 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc.
467 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; 465 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0;
468 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); 466 file_handle.set_file_handle(transit_file, open_flags, quota_file_io);
469 reply_context->params.AppendHandle(file_handle); 467 reply_context->params.AppendHandle(file_handle);
470 return true; 468 return true;
471 } 469 }
472 470
473 } // namespace content 471 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698