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

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

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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_graphics_2d_host.h" 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 525 }
526 526
527 int32_t PepperGraphics2DHost::OnHostMsgReadImageData( 527 int32_t PepperGraphics2DHost::OnHostMsgReadImageData(
528 ppapi::host::HostMessageContext* context, 528 ppapi::host::HostMessageContext* context,
529 PP_Resource image, 529 PP_Resource image,
530 const PP_Point& top_left) { 530 const PP_Point& top_left) {
531 context->reply_msg = PpapiPluginMsg_Graphics2D_ReadImageDataAck(); 531 context->reply_msg = PpapiPluginMsg_Graphics2D_ReadImageDataAck();
532 return ReadImageData(image, &top_left) ? PP_OK : PP_ERROR_FAILED; 532 return ReadImageData(image, &top_left) ? PP_OK : PP_ERROR_FAILED;
533 } 533 }
534 534
535 void PepperGraphics2DHost::ReleaseCallback(scoped_ptr<cc::SharedBitmap> bitmap, 535 void PepperGraphics2DHost::ReleaseCallback(
536 const gfx::Size& bitmap_size, 536 std::unique_ptr<cc::SharedBitmap> bitmap,
537 const gpu::SyncToken& sync_token, 537 const gfx::Size& bitmap_size,
538 bool lost_resource) { 538 const gpu::SyncToken& sync_token,
539 bool lost_resource) {
539 cached_bitmap_.reset(); 540 cached_bitmap_.reset();
540 // Only keep around a cached bitmap if the plugin is currently drawing (has 541 // Only keep around a cached bitmap if the plugin is currently drawing (has
541 // need_flush_ack_ set). 542 // need_flush_ack_ set).
542 if (need_flush_ack_ && bound_instance_) 543 if (need_flush_ack_ && bound_instance_)
543 cached_bitmap_ = std::move(bitmap); 544 cached_bitmap_ = std::move(bitmap);
544 cached_bitmap_size_ = bitmap_size; 545 cached_bitmap_size_ = bitmap_size;
545 } 546 }
546 547
547 bool PepperGraphics2DHost::PrepareTextureMailbox( 548 bool PepperGraphics2DHost::PrepareTextureMailbox(
548 cc::TextureMailbox* mailbox, 549 cc::TextureMailbox* mailbox,
549 scoped_ptr<cc::SingleReleaseCallback>* release_callback) { 550 std::unique_ptr<cc::SingleReleaseCallback>* release_callback) {
550 if (!texture_mailbox_modified_) 551 if (!texture_mailbox_modified_)
551 return false; 552 return false;
552 // TODO(jbauman): Send image_data_ through mailbox to avoid copy. 553 // TODO(jbauman): Send image_data_ through mailbox to avoid copy.
553 gfx::Size pixel_image_size(image_data_->width(), image_data_->height()); 554 gfx::Size pixel_image_size(image_data_->width(), image_data_->height());
554 scoped_ptr<cc::SharedBitmap> shared_bitmap; 555 std::unique_ptr<cc::SharedBitmap> shared_bitmap;
555 if (cached_bitmap_) { 556 if (cached_bitmap_) {
556 if (cached_bitmap_size_ == pixel_image_size) 557 if (cached_bitmap_size_ == pixel_image_size)
557 shared_bitmap = std::move(cached_bitmap_); 558 shared_bitmap = std::move(cached_bitmap_);
558 else 559 else
559 cached_bitmap_.reset(); 560 cached_bitmap_.reset();
560 } 561 }
561 if (!shared_bitmap) { 562 if (!shared_bitmap) {
562 shared_bitmap = RenderThreadImpl::current() 563 shared_bitmap = RenderThreadImpl::current()
563 ->shared_bitmap_manager() 564 ->shared_bitmap_manager()
564 ->AllocateSharedBitmap(pixel_image_size); 565 ->AllocateSharedBitmap(pixel_image_size);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 gfx::Point inverse_scaled_point = 800 gfx::Point inverse_scaled_point =
800 gfx::ScaleToFlooredPoint(*delta, inverse_scale); 801 gfx::ScaleToFlooredPoint(*delta, inverse_scale);
801 if (original_delta != inverse_scaled_point) 802 if (original_delta != inverse_scaled_point)
802 return false; 803 return false;
803 } 804 }
804 805
805 return true; 806 return true;
806 } 807 }
807 808
808 } // namespace content 809 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.h ('k') | content/renderer/pepper/pepper_graphics_2d_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698