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

Side by Side Diff: content/renderer/pepper/pepper_file_io_host.cc

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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/renderer/pepper/pepper_file_io_host.h" 5 #include "content/renderer/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/command_line.h" 10 #include "base/command_line.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 int32_t PepperFileIOHost::OnHostMsgWrite( 280 int32_t PepperFileIOHost::OnHostMsgWrite(
281 ppapi::host::HostMessageContext* context, 281 ppapi::host::HostMessageContext* context,
282 int64_t offset, 282 int64_t offset,
283 const std::string& buffer) { 283 const std::string& buffer) {
284 int32_t rv = state_manager_.CheckOperationState( 284 int32_t rv = state_manager_.CheckOperationState(
285 FileIOStateManager::OPERATION_WRITE, true); 285 FileIOStateManager::OPERATION_WRITE, true);
286 if (rv != PP_OK) 286 if (rv != PP_OK)
287 return rv; 287 return rv;
288 288
289 if (quota_file_io_.get()) { 289 if (quota_file_io_) {
290 if (!quota_file_io_->Write( 290 if (!quota_file_io_->Write(
291 offset, buffer.c_str(), buffer.size(), 291 offset, buffer.c_str(), buffer.size(),
292 base::Bind(&PepperFileIOHost::ExecutePlatformWriteCallback, 292 base::Bind(&PepperFileIOHost::ExecutePlatformWriteCallback,
293 weak_factory_.GetWeakPtr(), 293 weak_factory_.GetWeakPtr(),
294 context->MakeReplyMessageContext()))) 294 context->MakeReplyMessageContext())))
295 return PP_ERROR_FAILED; 295 return PP_ERROR_FAILED;
296 } else { 296 } else {
297 if (!plugin_delegate_) 297 if (!plugin_delegate_)
298 return PP_ERROR_FAILED; 298 return PP_ERROR_FAILED;
299 299
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 int32_t PepperFileIOHost::OnHostMsgWillWrite( 381 int32_t PepperFileIOHost::OnHostMsgWillWrite(
382 ppapi::host::HostMessageContext* context, 382 ppapi::host::HostMessageContext* context,
383 int64_t offset, 383 int64_t offset,
384 int32_t bytes_to_write) { 384 int32_t bytes_to_write) {
385 int32_t rv = state_manager_.CheckOperationState( 385 int32_t rv = state_manager_.CheckOperationState(
386 FileIOStateManager::OPERATION_EXCLUSIVE, true); 386 FileIOStateManager::OPERATION_EXCLUSIVE, true);
387 if (rv != PP_OK) 387 if (rv != PP_OK)
388 return rv; 388 return rv;
389 389
390 if (!quota_file_io_.get()) 390 if (!quota_file_io_)
391 return PP_OK; 391 return PP_OK;
392 392
393 if (!quota_file_io_->WillWrite( 393 if (!quota_file_io_->WillWrite(
394 offset, bytes_to_write, 394 offset, bytes_to_write,
395 base::Bind(&PepperFileIOHost::ExecutePlatformWriteCallback, 395 base::Bind(&PepperFileIOHost::ExecutePlatformWriteCallback,
396 weak_factory_.GetWeakPtr(), 396 weak_factory_.GetWeakPtr(),
397 context->MakeReplyMessageContext()))) 397 context->MakeReplyMessageContext())))
398 return PP_ERROR_FAILED; 398 return PP_ERROR_FAILED;
399 399
400 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); 400 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
401 return PP_OK_COMPLETIONPENDING; 401 return PP_OK_COMPLETIONPENDING;
402 } 402 }
403 403
404 int32_t PepperFileIOHost::OnHostMsgWillSetLength( 404 int32_t PepperFileIOHost::OnHostMsgWillSetLength(
405 ppapi::host::HostMessageContext* context, 405 ppapi::host::HostMessageContext* context,
406 int64_t length) { 406 int64_t length) {
407 int32_t rv = state_manager_.CheckOperationState( 407 int32_t rv = state_manager_.CheckOperationState(
408 FileIOStateManager::OPERATION_EXCLUSIVE, true); 408 FileIOStateManager::OPERATION_EXCLUSIVE, true);
409 if (rv != PP_OK) 409 if (rv != PP_OK)
410 return rv; 410 return rv;
411 411
412 if (!quota_file_io_.get()) 412 if (!quota_file_io_)
413 return PP_OK; 413 return PP_OK;
414 414
415 if (!quota_file_io_->WillSetLength( 415 if (!quota_file_io_->WillSetLength(
416 length, 416 length,
417 base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback, 417 base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback,
418 weak_factory_.GetWeakPtr(), 418 weak_factory_.GetWeakPtr(),
419 context->MakeReplyMessageContext()))) 419 context->MakeReplyMessageContext())))
420 return PP_ERROR_FAILED; 420 return PP_ERROR_FAILED;
421 421
422 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); 422 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // On the plugin side, the callback expects a parameter with different meaning 557 // On the plugin side, the callback expects a parameter with different meaning
558 // depends on whether is negative or not. It is the result here. We translate 558 // depends on whether is negative or not. It is the result here. We translate
559 // for the callback. 559 // for the callback.
560 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); 560 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code);
561 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); 561 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written));
562 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); 562 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply());
563 state_manager_.SetOperationFinished(); 563 state_manager_.SetOperationFinished();
564 } 564 }
565 565
566 } // namespace content 566 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698