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

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

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/output/copy_output_request.cc ('k') | cc/output/copy_output_result.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 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 #ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_ 5 #ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_
6 #define CC_OUTPUT_COPY_OUTPUT_RESULT_H_ 6 #define CC_OUTPUT_COPY_OUTPUT_RESULT_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include <memory>
9
10 #include "base/memory/ptr_util.h"
9 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
10 #include "cc/resources/single_release_callback.h" 12 #include "cc/resources/single_release_callback.h"
11 #include "cc/resources/texture_mailbox.h" 13 #include "cc/resources/texture_mailbox.h"
12 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
13 15
14 class SkBitmap; 16 class SkBitmap;
15 17
16 namespace cc { 18 namespace cc {
17 class TextureMailbox; 19 class TextureMailbox;
18 20
19 class CC_EXPORT CopyOutputResult { 21 class CC_EXPORT CopyOutputResult {
20 public: 22 public:
21 static scoped_ptr<CopyOutputResult> CreateEmptyResult() { 23 static std::unique_ptr<CopyOutputResult> CreateEmptyResult() {
22 return make_scoped_ptr(new CopyOutputResult); 24 return base::WrapUnique(new CopyOutputResult);
23 } 25 }
24 static scoped_ptr<CopyOutputResult> CreateBitmapResult( 26 static std::unique_ptr<CopyOutputResult> CreateBitmapResult(
25 scoped_ptr<SkBitmap> bitmap) { 27 std::unique_ptr<SkBitmap> bitmap) {
26 return make_scoped_ptr(new CopyOutputResult(std::move(bitmap))); 28 return base::WrapUnique(new CopyOutputResult(std::move(bitmap)));
27 } 29 }
28 static scoped_ptr<CopyOutputResult> CreateTextureResult( 30 static std::unique_ptr<CopyOutputResult> CreateTextureResult(
29 const gfx::Size& size, 31 const gfx::Size& size,
30 const TextureMailbox& texture_mailbox, 32 const TextureMailbox& texture_mailbox,
31 scoped_ptr<SingleReleaseCallback> release_callback) { 33 std::unique_ptr<SingleReleaseCallback> release_callback) {
32 return make_scoped_ptr(new CopyOutputResult(size, texture_mailbox, 34 return base::WrapUnique(new CopyOutputResult(size, texture_mailbox,
33 std::move(release_callback))); 35 std::move(release_callback)));
34 } 36 }
35 37
36 ~CopyOutputResult(); 38 ~CopyOutputResult();
37 39
38 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } 40 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); }
39 bool HasBitmap() const { return !!bitmap_; } 41 bool HasBitmap() const { return !!bitmap_; }
40 bool HasTexture() const { return texture_mailbox_.IsValid(); } 42 bool HasTexture() const { return texture_mailbox_.IsValid(); }
41 43
42 gfx::Size size() const { return size_; } 44 gfx::Size size() const { return size_; }
43 scoped_ptr<SkBitmap> TakeBitmap(); 45 std::unique_ptr<SkBitmap> TakeBitmap();
44 void TakeTexture(TextureMailbox* texture_mailbox, 46 void TakeTexture(TextureMailbox* texture_mailbox,
45 scoped_ptr<SingleReleaseCallback>* release_callback); 47 std::unique_ptr<SingleReleaseCallback>* release_callback);
46 48
47 private: 49 private:
48 CopyOutputResult(); 50 CopyOutputResult();
49 explicit CopyOutputResult(scoped_ptr<SkBitmap> bitmap); 51 explicit CopyOutputResult(std::unique_ptr<SkBitmap> bitmap);
50 explicit CopyOutputResult(const gfx::Size& size, 52 explicit CopyOutputResult(
51 const TextureMailbox& texture_mailbox, 53 const gfx::Size& size,
52 scoped_ptr<SingleReleaseCallback> release_callback); 54 const TextureMailbox& texture_mailbox,
55 std::unique_ptr<SingleReleaseCallback> release_callback);
53 56
54 gfx::Size size_; 57 gfx::Size size_;
55 scoped_ptr<SkBitmap> bitmap_; 58 std::unique_ptr<SkBitmap> bitmap_;
56 TextureMailbox texture_mailbox_; 59 TextureMailbox texture_mailbox_;
57 scoped_ptr<SingleReleaseCallback> release_callback_; 60 std::unique_ptr<SingleReleaseCallback> release_callback_;
58 }; 61 };
59 62
60 } // namespace cc 63 } // namespace cc
61 64
62 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ 65 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_
OLDNEW
« no previous file with comments | « cc/output/copy_output_request.cc ('k') | cc/output/copy_output_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698