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

Side by Side Diff: cc/output/copy_output_result.cc

Issue 2670213006: Mojom structs for copy requests / results should map to unique_ptr (Closed)
Patch Set: c Created 3 years, 10 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/output/copy_output_result.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/output/copy_output_result.h" 5 #include "cc/output/copy_output_result.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/resources/texture_mailbox.h" 8 #include "cc/resources/texture_mailbox.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 CopyOutputResult::CopyOutputResult() {} 12 CopyOutputResult::CopyOutputResult() {}
13 13
14 CopyOutputResult::CopyOutputResult(std::unique_ptr<SkBitmap> bitmap) 14 CopyOutputResult::CopyOutputResult(std::unique_ptr<SkBitmap> bitmap)
15 : size_(bitmap->width(), bitmap->height()), bitmap_(std::move(bitmap)) { 15 : size_(bitmap->width(), bitmap->height()), bitmap_(std::move(bitmap)) {
16 DCHECK(bitmap_); 16 DCHECK(bitmap_);
17 } 17 }
18 18
19 CopyOutputResult::CopyOutputResult( 19 CopyOutputResult::CopyOutputResult(
20 const gfx::Size& size, 20 const gfx::Size& size,
21 const TextureMailbox& texture_mailbox, 21 const TextureMailbox& texture_mailbox,
22 std::unique_ptr<SingleReleaseCallback> release_callback) 22 std::unique_ptr<SingleReleaseCallback> release_callback)
23 : size_(size), 23 : size_(size),
24 texture_mailbox_(texture_mailbox), 24 texture_mailbox_(texture_mailbox),
25 release_callback_(std::move(release_callback)) { 25 release_callback_(std::move(release_callback)) {
26 DCHECK(texture_mailbox_.IsTexture()); 26 DCHECK(texture_mailbox_.IsTexture());
27 } 27 }
28 28
29 CopyOutputResult::CopyOutputResult(CopyOutputResult&& other) = default;
30
31 CopyOutputResult::~CopyOutputResult() { 29 CopyOutputResult::~CopyOutputResult() {
32 if (release_callback_) 30 if (release_callback_)
33 release_callback_->Run(gpu::SyncToken(), false); 31 release_callback_->Run(gpu::SyncToken(), false);
34 } 32 }
35 33
36 CopyOutputResult& CopyOutputResult::operator=(CopyOutputResult&& other) =
37 default;
38
39 std::unique_ptr<SkBitmap> CopyOutputResult::TakeBitmap() { 34 std::unique_ptr<SkBitmap> CopyOutputResult::TakeBitmap() {
40 return std::move(bitmap_); 35 return std::move(bitmap_);
41 } 36 }
42 37
43 void CopyOutputResult::TakeTexture( 38 void CopyOutputResult::TakeTexture(
44 TextureMailbox* texture_mailbox, 39 TextureMailbox* texture_mailbox,
45 std::unique_ptr<SingleReleaseCallback>* release_callback) { 40 std::unique_ptr<SingleReleaseCallback>* release_callback) {
46 *texture_mailbox = texture_mailbox_; 41 *texture_mailbox = texture_mailbox_;
47 *release_callback = std::move(release_callback_); 42 *release_callback = std::move(release_callback_);
48 43
49 texture_mailbox_ = TextureMailbox(); 44 texture_mailbox_ = TextureMailbox();
50 } 45 }
51 46
52 } // namespace cc 47 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/copy_output_result.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698