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

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

Issue 2659703002: Implemented StructTraits for cc::CopyOutputResult (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') | gpu/ipc/common/mailbox_holder_struct_traits.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 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 #include "third_party/skia/include/core/SkBitmap.h"
10 9
11 namespace cc { 10 namespace cc {
12 11
13 CopyOutputResult::CopyOutputResult() {} 12 CopyOutputResult::CopyOutputResult() {}
14 13
15 CopyOutputResult::CopyOutputResult(std::unique_ptr<SkBitmap> bitmap) 14 CopyOutputResult::CopyOutputResult(std::unique_ptr<SkBitmap> bitmap)
16 : size_(bitmap->width(), bitmap->height()), bitmap_(std::move(bitmap)) { 15 : size_(bitmap->width(), bitmap->height()), bitmap_(std::move(bitmap)) {
17 DCHECK(bitmap_); 16 DCHECK(bitmap_);
18 } 17 }
19 18
20 CopyOutputResult::CopyOutputResult( 19 CopyOutputResult::CopyOutputResult(
21 const gfx::Size& size, 20 const gfx::Size& size,
22 const TextureMailbox& texture_mailbox, 21 const TextureMailbox& texture_mailbox,
23 std::unique_ptr<SingleReleaseCallback> release_callback) 22 std::unique_ptr<SingleReleaseCallback> release_callback)
24 : size_(size), 23 : size_(size),
25 texture_mailbox_(texture_mailbox), 24 texture_mailbox_(texture_mailbox),
26 release_callback_(std::move(release_callback)) { 25 release_callback_(std::move(release_callback)) {
27 DCHECK(texture_mailbox_.IsTexture()); 26 DCHECK(texture_mailbox_.IsTexture());
28 } 27 }
29 28
29 CopyOutputResult::CopyOutputResult(CopyOutputResult&& other) = default;
30
30 CopyOutputResult::~CopyOutputResult() { 31 CopyOutputResult::~CopyOutputResult() {
31 if (release_callback_) 32 if (release_callback_)
32 release_callback_->Run(gpu::SyncToken(), false); 33 release_callback_->Run(gpu::SyncToken(), false);
33 } 34 }
34 35
36 CopyOutputResult& CopyOutputResult::operator=(CopyOutputResult&& other) =
37 default;
38
35 std::unique_ptr<SkBitmap> CopyOutputResult::TakeBitmap() { 39 std::unique_ptr<SkBitmap> CopyOutputResult::TakeBitmap() {
36 return std::move(bitmap_); 40 return std::move(bitmap_);
37 } 41 }
38 42
39 void CopyOutputResult::TakeTexture( 43 void CopyOutputResult::TakeTexture(
40 TextureMailbox* texture_mailbox, 44 TextureMailbox* texture_mailbox,
41 std::unique_ptr<SingleReleaseCallback>* release_callback) { 45 std::unique_ptr<SingleReleaseCallback>* release_callback) {
42 *texture_mailbox = texture_mailbox_; 46 *texture_mailbox = texture_mailbox_;
43 *release_callback = std::move(release_callback_); 47 *release_callback = std::move(release_callback_);
44 48
45 texture_mailbox_ = TextureMailbox(); 49 texture_mailbox_ = TextureMailbox();
46 } 50 }
47 51
48 } // namespace cc 52 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/copy_output_result.h ('k') | gpu/ipc/common/mailbox_holder_struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698