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

Side by Side Diff: cc/blink/web_external_texture_layer_impl.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase 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
« no previous file with comments | « cc/blink/web_external_texture_layer_impl.h ('k') | cc/blink/web_image_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/blink/web_external_texture_layer_impl.h" 5 #include "cc/blink/web_external_texture_layer_impl.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "cc/blink/web_external_bitmap_impl.h" 8 #include "cc/blink/web_external_bitmap_impl.h"
8 #include "cc/blink/web_layer_impl.h" 9 #include "cc/blink/web_layer_impl.h"
9 #include "cc/layers/texture_layer.h" 10 #include "cc/layers/texture_layer.h"
10 #include "cc/resources/single_release_callback.h" 11 #include "cc/resources/single_release_callback.h"
11 #include "cc/resources/texture_mailbox.h" 12 #include "cc/resources/texture_mailbox.h"
12 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" 13 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h"
13 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" 14 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h"
14 #include "third_party/WebKit/public/platform/WebFloatRect.h" 15 #include "third_party/WebKit/public/platform/WebFloatRect.h"
15 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
16 #include "third_party/WebKit/public/platform/WebSize.h" 17 #include "third_party/WebKit/public/platform/WebSize.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static_cast<TextureLayer*>(layer_->layer())->SetBlendBackgroundColor(blend); 57 static_cast<TextureLayer*>(layer_->layer())->SetBlendBackgroundColor(blend);
57 } 58 }
58 59
59 void WebExternalTextureLayerImpl::setNearestNeighbor(bool nearest_neighbor) { 60 void WebExternalTextureLayerImpl::setNearestNeighbor(bool nearest_neighbor) {
60 static_cast<TextureLayer*>(layer_->layer()) 61 static_cast<TextureLayer*>(layer_->layer())
61 ->SetNearestNeighbor(nearest_neighbor); 62 ->SetNearestNeighbor(nearest_neighbor);
62 } 63 }
63 64
64 bool WebExternalTextureLayerImpl::PrepareTextureMailbox( 65 bool WebExternalTextureLayerImpl::PrepareTextureMailbox(
65 cc::TextureMailbox* mailbox, 66 cc::TextureMailbox* mailbox,
66 scoped_ptr<cc::SingleReleaseCallback>* release_callback, 67 std::unique_ptr<cc::SingleReleaseCallback>* release_callback,
67 bool use_shared_memory) { 68 bool use_shared_memory) {
68 blink::WebExternalTextureMailbox client_mailbox; 69 blink::WebExternalTextureMailbox client_mailbox;
69 WebExternalBitmapImpl* bitmap = nullptr; 70 WebExternalBitmapImpl* bitmap = nullptr;
70 71
71 if (use_shared_memory) 72 if (use_shared_memory)
72 bitmap = AllocateBitmap(); 73 bitmap = AllocateBitmap();
73 if (!client_->prepareMailbox(&client_mailbox, bitmap)) { 74 if (!client_->prepareMailbox(&client_mailbox, bitmap)) {
74 if (bitmap) 75 if (bitmap)
75 free_bitmaps_.push_back(make_scoped_ptr(bitmap)); 76 free_bitmaps_.push_back(base::WrapUnique(bitmap));
76 return false; 77 return false;
77 } 78 }
78 gpu::Mailbox name; 79 gpu::Mailbox name;
79 name.SetName(client_mailbox.name); 80 name.SetName(client_mailbox.name);
80 if (bitmap) { 81 if (bitmap) {
81 *mailbox = cc::TextureMailbox(bitmap->shared_bitmap(), bitmap->size()); 82 *mailbox = cc::TextureMailbox(bitmap->shared_bitmap(), bitmap->size());
82 } else { 83 } else {
83 gpu::SyncToken sync_token; 84 gpu::SyncToken sync_token;
84 static_assert(sizeof(sync_token) <= sizeof(client_mailbox.syncToken), 85 static_assert(sizeof(sync_token) <= sizeof(client_mailbox.syncToken),
85 "Size of web external sync token too small."); 86 "Size of web external sync token too small.");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 bool lost_resource) { 128 bool lost_resource) {
128 DCHECK(layer); 129 DCHECK(layer);
129 blink::WebExternalTextureMailbox available_mailbox; 130 blink::WebExternalTextureMailbox available_mailbox;
130 static_assert(sizeof(sync_token) <= sizeof(available_mailbox.syncToken), 131 static_assert(sizeof(sync_token) <= sizeof(available_mailbox.syncToken),
131 "Size of web external sync token too small."); 132 "Size of web external sync token too small.");
132 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); 133 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name));
133 memcpy(available_mailbox.syncToken, sync_token.GetConstData(), 134 memcpy(available_mailbox.syncToken, sync_token.GetConstData(),
134 sizeof(sync_token)); 135 sizeof(sync_token));
135 available_mailbox.validSyncToken = sync_token.HasData(); 136 available_mailbox.validSyncToken = sync_token.HasData();
136 if (bitmap) 137 if (bitmap)
137 layer->free_bitmaps_.push_back(make_scoped_ptr(bitmap)); 138 layer->free_bitmaps_.push_back(base::WrapUnique(bitmap));
138 layer->client_->mailboxReleased(available_mailbox, lost_resource); 139 layer->client_->mailboxReleased(available_mailbox, lost_resource);
139 } 140 }
140 141
141 } // namespace cc_blink 142 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_external_texture_layer_impl.h ('k') | cc/blink/web_image_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698