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

Side by Side Diff: cc/layers/texture_layer_unittest.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_impl.cc ('k') | cc/layers/ui_resource_layer_impl_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/layers/texture_layer.h" 5 #include "cc/layers/texture_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 FakeTextureLayerClient() : mailbox_changed_(true) {} 85 FakeTextureLayerClient() : mailbox_changed_(true) {}
86 86
87 bool PrepareTextureMailbox( 87 bool PrepareTextureMailbox(
88 TextureMailbox* mailbox, 88 TextureMailbox* mailbox,
89 scoped_ptr<SingleReleaseCallback>* release_callback, 89 scoped_ptr<SingleReleaseCallback>* release_callback,
90 bool use_shared_memory) override { 90 bool use_shared_memory) override {
91 if (!mailbox_changed_) 91 if (!mailbox_changed_)
92 return false; 92 return false;
93 93
94 *mailbox = mailbox_; 94 *mailbox = mailbox_;
95 *release_callback = release_callback_.Pass(); 95 *release_callback = std::move(release_callback_);
96 mailbox_changed_ = false; 96 mailbox_changed_ = false;
97 return true; 97 return true;
98 } 98 }
99 99
100 void set_mailbox(const TextureMailbox& mailbox, 100 void set_mailbox(const TextureMailbox& mailbox,
101 scoped_ptr<SingleReleaseCallback> release_callback) { 101 scoped_ptr<SingleReleaseCallback> release_callback) {
102 mailbox_ = mailbox; 102 mailbox_ = mailbox;
103 release_callback_ = release_callback.Pass(); 103 release_callback_ = std::move(release_callback);
104 mailbox_changed_ = true; 104 mailbox_changed_ = true;
105 } 105 }
106 106
107 private: 107 private:
108 TextureMailbox mailbox_; 108 TextureMailbox mailbox_;
109 scoped_ptr<SingleReleaseCallback> release_callback_; 109 scoped_ptr<SingleReleaseCallback> release_callback_;
110 bool mailbox_changed_; 110 bool mailbox_changed_;
111 DISALLOW_COPY_AND_ASSIGN(FakeTextureLayerClient); 111 DISALLOW_COPY_AND_ASSIGN(FakeTextureLayerClient);
112 }; 112 };
113 113
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 641 }
642 642
643 void SetMailbox(char mailbox_char) { 643 void SetMailbox(char mailbox_char) {
644 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); 644 EXPECT_EQ(true, main_thread_.CalledOnValidThread());
645 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( 645 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
646 base::Bind( 646 base::Bind(
647 &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback, 647 &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback,
648 base::Unretained(this))); 648 base::Unretained(this)));
649 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char), 649 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char),
650 gpu::SyncToken(), GL_TEXTURE_2D), 650 gpu::SyncToken(), GL_TEXTURE_2D),
651 callback.Pass()); 651 std::move(callback));
652 } 652 }
653 653
654 void BeginTest() override { 654 void BeginTest() override {
655 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); 655 EXPECT_EQ(true, main_thread_.CalledOnValidThread());
656 656
657 gfx::Size bounds(100, 100); 657 gfx::Size bounds(100, 100);
658 root_ = Layer::Create(layer_settings()); 658 root_ = Layer::Create(layer_settings());
659 root_->SetBounds(bounds); 659 root_->SetBounds(bounds);
660 660
661 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); 661 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 757
758 static void ReleaseCallback(const gpu::SyncToken& sync_token, 758 static void ReleaseCallback(const gpu::SyncToken& sync_token,
759 bool lost_resource) {} 759 bool lost_resource) {}
760 760
761 void SetMailbox(char mailbox_char) { 761 void SetMailbox(char mailbox_char) {
762 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( 762 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
763 base::Bind( 763 base::Bind(
764 &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback)); 764 &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback));
765 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char), 765 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char),
766 gpu::SyncToken(), GL_TEXTURE_2D), 766 gpu::SyncToken(), GL_TEXTURE_2D),
767 callback.Pass()); 767 std::move(callback));
768 } 768 }
769 769
770 void BeginTest() override { 770 void BeginTest() override {
771 gfx::Size bounds(100, 100); 771 gfx::Size bounds(100, 100);
772 root_ = Layer::Create(layer_settings()); 772 root_ = Layer::Create(layer_settings());
773 root_->SetBounds(bounds); 773 root_->SetBounds(bounds);
774 774
775 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); 775 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
776 layer_->SetIsDrawable(true); 776 layer_->SetIsDrawable(true);
777 layer_->SetBounds(bounds); 777 layer_->SetBounds(bounds);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 } 1345 }
1346 1346
1347 void SetMailbox(char mailbox_char) { 1347 void SetMailbox(char mailbox_char) {
1348 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); 1348 EXPECT_EQ(true, main_thread_.CalledOnValidThread());
1349 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( 1349 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1350 base::Bind( 1350 base::Bind(
1351 &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback, 1351 &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback,
1352 base::Unretained(this))); 1352 base::Unretained(this)));
1353 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char), 1353 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char),
1354 gpu::SyncToken(), GL_TEXTURE_2D), 1354 gpu::SyncToken(), GL_TEXTURE_2D),
1355 callback.Pass()); 1355 std::move(callback));
1356 } 1356 }
1357 1357
1358 void SetupTree() override { 1358 void SetupTree() override {
1359 gfx::Size bounds(100, 100); 1359 gfx::Size bounds(100, 100);
1360 root_ = Layer::Create(layer_settings()); 1360 root_ = Layer::Create(layer_settings());
1361 root_->SetBounds(bounds); 1361 root_->SetBounds(bounds);
1362 1362
1363 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); 1363 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
1364 layer_->SetIsDrawable(true); 1364 layer_->SetIsDrawable(true);
1365 layer_->SetBounds(bounds); 1365 layer_->SetBounds(bounds);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 } 1414 }
1415 1415
1416 void SetMailbox(char mailbox_char) { 1416 void SetMailbox(char mailbox_char) {
1417 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); 1417 EXPECT_EQ(true, main_thread_.CalledOnValidThread());
1418 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( 1418 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
1419 base::Bind( 1419 base::Bind(
1420 &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback, 1420 &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback,
1421 base::Unretained(this))); 1421 base::Unretained(this)));
1422 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char), 1422 layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char),
1423 gpu::SyncToken(), GL_TEXTURE_2D), 1423 gpu::SyncToken(), GL_TEXTURE_2D),
1424 callback.Pass()); 1424 std::move(callback));
1425 } 1425 }
1426 1426
1427 void SetupTree() override { 1427 void SetupTree() override {
1428 gfx::Size bounds(100, 100); 1428 gfx::Size bounds(100, 100);
1429 root_ = Layer::Create(layer_settings()); 1429 root_ = Layer::Create(layer_settings());
1430 root_->SetBounds(bounds); 1430 root_->SetBounds(bounds);
1431 1431
1432 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); 1432 layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr);
1433 layer_->SetIsDrawable(true); 1433 layer_->SetIsDrawable(true);
1434 layer_->SetBounds(bounds); 1434 layer_->SetBounds(bounds);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 int callback_count_; 1471 int callback_count_;
1472 scoped_refptr<Layer> root_; 1472 scoped_refptr<Layer> root_;
1473 scoped_refptr<TextureLayer> layer_; 1473 scoped_refptr<TextureLayer> layer_;
1474 }; 1474 };
1475 1475
1476 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1476 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1477 TextureLayerWithMailboxImplThreadDeleted); 1477 TextureLayerWithMailboxImplThreadDeleted);
1478 1478
1479 } // namespace 1479 } // namespace
1480 } // namespace cc 1480 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_impl.cc ('k') | cc/layers/ui_resource_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698