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

Side by Side Diff: cc/layers/texture_layer_impl.cc

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 years, 1 month 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/layers/texture_layer.cc ('k') | cc/layers/texture_layer_unittest.cc » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/texture_layer_impl.h" 5 #include "cc/layers/texture_layer_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "cc/output/renderer.h" 10 #include "cc/output/renderer.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 TextureLayerImpl::~TextureLayerImpl() { FreeTextureMailbox(); } 37 TextureLayerImpl::~TextureLayerImpl() { FreeTextureMailbox(); }
38 38
39 void TextureLayerImpl::SetTextureMailbox( 39 void TextureLayerImpl::SetTextureMailbox(
40 const TextureMailbox& mailbox, 40 const TextureMailbox& mailbox,
41 scoped_ptr<SingleReleaseCallbackImpl> release_callback) { 41 scoped_ptr<SingleReleaseCallbackImpl> release_callback) {
42 DCHECK_EQ(mailbox.IsValid(), !!release_callback); 42 DCHECK_EQ(mailbox.IsValid(), !!release_callback);
43 FreeTextureMailbox(); 43 FreeTextureMailbox();
44 texture_mailbox_ = mailbox; 44 texture_mailbox_ = mailbox;
45 release_callback_ = release_callback.Pass(); 45 release_callback_ = std::move(release_callback);
46 own_mailbox_ = true; 46 own_mailbox_ = true;
47 valid_texture_copy_ = false; 47 valid_texture_copy_ = false;
48 SetNeedsPushProperties(); 48 SetNeedsPushProperties();
49 } 49 }
50 50
51 scoped_ptr<LayerImpl> TextureLayerImpl::CreateLayerImpl( 51 scoped_ptr<LayerImpl> TextureLayerImpl::CreateLayerImpl(
52 LayerTreeImpl* tree_impl) { 52 LayerTreeImpl* tree_impl) {
53 return TextureLayerImpl::Create(tree_impl, id()); 53 return TextureLayerImpl::Create(tree_impl, id());
54 } 54 }
55 55
56 void TextureLayerImpl::PushPropertiesTo(LayerImpl* layer) { 56 void TextureLayerImpl::PushPropertiesTo(LayerImpl* layer) {
57 LayerImpl::PushPropertiesTo(layer); 57 LayerImpl::PushPropertiesTo(layer);
58 58
59 TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer); 59 TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer);
60 texture_layer->SetFlipped(flipped_); 60 texture_layer->SetFlipped(flipped_);
61 texture_layer->SetUVTopLeft(uv_top_left_); 61 texture_layer->SetUVTopLeft(uv_top_left_);
62 texture_layer->SetUVBottomRight(uv_bottom_right_); 62 texture_layer->SetUVBottomRight(uv_bottom_right_);
63 texture_layer->SetVertexOpacity(vertex_opacity_); 63 texture_layer->SetVertexOpacity(vertex_opacity_);
64 texture_layer->SetPremultipliedAlpha(premultiplied_alpha_); 64 texture_layer->SetPremultipliedAlpha(premultiplied_alpha_);
65 texture_layer->SetBlendBackgroundColor(blend_background_color_); 65 texture_layer->SetBlendBackgroundColor(blend_background_color_);
66 texture_layer->SetNearestNeighbor(nearest_neighbor_); 66 texture_layer->SetNearestNeighbor(nearest_neighbor_);
67 if (own_mailbox_) { 67 if (own_mailbox_) {
68 texture_layer->SetTextureMailbox(texture_mailbox_, 68 texture_layer->SetTextureMailbox(texture_mailbox_,
69 release_callback_.Pass()); 69 std::move(release_callback_));
70 own_mailbox_ = false; 70 own_mailbox_ = false;
71 } 71 }
72 } 72 }
73 73
74 bool TextureLayerImpl::WillDraw(DrawMode draw_mode, 74 bool TextureLayerImpl::WillDraw(DrawMode draw_mode,
75 ResourceProvider* resource_provider) { 75 ResourceProvider* resource_provider) {
76 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) 76 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
77 return false; 77 return false;
78 78
79 if (own_mailbox_) { 79 if (own_mailbox_) {
80 DCHECK(!external_texture_resource_); 80 DCHECK(!external_texture_resource_);
81 if ((draw_mode == DRAW_MODE_HARDWARE && texture_mailbox_.IsTexture()) || 81 if ((draw_mode == DRAW_MODE_HARDWARE && texture_mailbox_.IsTexture()) ||
82 (draw_mode == DRAW_MODE_SOFTWARE && 82 (draw_mode == DRAW_MODE_SOFTWARE &&
83 texture_mailbox_.IsSharedMemory())) { 83 texture_mailbox_.IsSharedMemory())) {
84 external_texture_resource_ = 84 external_texture_resource_ =
85 resource_provider->CreateResourceFromTextureMailbox( 85 resource_provider->CreateResourceFromTextureMailbox(
86 texture_mailbox_, release_callback_.Pass()); 86 texture_mailbox_, std::move(release_callback_));
87 DCHECK(external_texture_resource_); 87 DCHECK(external_texture_resource_);
88 texture_copy_ = nullptr; 88 texture_copy_ = nullptr;
89 valid_texture_copy_ = false; 89 valid_texture_copy_ = false;
90 } 90 }
91 if (external_texture_resource_) 91 if (external_texture_resource_)
92 own_mailbox_ = false; 92 own_mailbox_ = false;
93 } 93 }
94 94
95 if (!valid_texture_copy_ && draw_mode == DRAW_MODE_HARDWARE && 95 if (!valid_texture_copy_ && draw_mode == DRAW_MODE_HARDWARE &&
96 texture_mailbox_.IsSharedMemory()) { 96 texture_mailbox_.IsSharedMemory()) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } else if (external_texture_resource_) { 257 } else if (external_texture_resource_) {
258 DCHECK(!own_mailbox_); 258 DCHECK(!own_mailbox_);
259 ResourceProvider* resource_provider = 259 ResourceProvider* resource_provider =
260 layer_tree_impl()->resource_provider(); 260 layer_tree_impl()->resource_provider();
261 resource_provider->DeleteResource(external_texture_resource_); 261 resource_provider->DeleteResource(external_texture_resource_);
262 external_texture_resource_ = 0; 262 external_texture_resource_ = 0;
263 } 263 }
264 } 264 }
265 265
266 } // namespace cc 266 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698