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

Side by Side Diff: cc/output/copy_output_request.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/compositor_frame_ack.h ('k') | cc/output/copy_output_request.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_REQUEST_H_ 5 #ifndef CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
6 #define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ 6 #define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
7 7
8 #include <memory>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/ptr_util.h"
10 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
11 #include "cc/resources/single_release_callback.h" 13 #include "cc/resources/single_release_callback.h"
12 #include "cc/resources/texture_mailbox.h" 14 #include "cc/resources/texture_mailbox.h"
13 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
14 16
15 class SkBitmap; 17 class SkBitmap;
16 18
17 namespace cc { 19 namespace cc {
18 class CopyOutputResult; 20 class CopyOutputResult;
19 21
20 class CC_EXPORT CopyOutputRequest { 22 class CC_EXPORT CopyOutputRequest {
21 public: 23 public:
22 typedef base::Callback<void(scoped_ptr<CopyOutputResult> result)> 24 typedef base::Callback<void(std::unique_ptr<CopyOutputResult> result)>
23 CopyOutputRequestCallback; 25 CopyOutputRequestCallback;
24 26
25 static scoped_ptr<CopyOutputRequest> CreateEmptyRequest() { 27 static std::unique_ptr<CopyOutputRequest> CreateEmptyRequest() {
26 return make_scoped_ptr(new CopyOutputRequest); 28 return base::WrapUnique(new CopyOutputRequest);
27 } 29 }
28 static scoped_ptr<CopyOutputRequest> CreateRequest( 30 static std::unique_ptr<CopyOutputRequest> CreateRequest(
29 const CopyOutputRequestCallback& result_callback) { 31 const CopyOutputRequestCallback& result_callback) {
30 return make_scoped_ptr(new CopyOutputRequest(false, result_callback)); 32 return base::WrapUnique(new CopyOutputRequest(false, result_callback));
31 } 33 }
32 static scoped_ptr<CopyOutputRequest> CreateBitmapRequest( 34 static std::unique_ptr<CopyOutputRequest> CreateBitmapRequest(
33 const CopyOutputRequestCallback& result_callback) { 35 const CopyOutputRequestCallback& result_callback) {
34 return make_scoped_ptr(new CopyOutputRequest(true, result_callback)); 36 return base::WrapUnique(new CopyOutputRequest(true, result_callback));
35 } 37 }
36 static scoped_ptr<CopyOutputRequest> CreateRelayRequest( 38 static std::unique_ptr<CopyOutputRequest> CreateRelayRequest(
37 const CopyOutputRequest& original_request, 39 const CopyOutputRequest& original_request,
38 const CopyOutputRequestCallback& result_callback); 40 const CopyOutputRequestCallback& result_callback);
39 41
40 ~CopyOutputRequest(); 42 ~CopyOutputRequest();
41 43
42 bool IsEmpty() const { return result_callback_.is_null(); } 44 bool IsEmpty() const { return result_callback_.is_null(); }
43 45
44 // Optionally specify the source of this copy request. If set when this copy 46 // Optionally specify the source of this copy request. If set when this copy
45 // request is submitted to a layer, a prior uncommitted copy request from the 47 // request is submitted to a layer, a prior uncommitted copy request from the
46 // same |source| will be aborted. 48 // same |source| will be aborted.
(...skipping 13 matching lines...) Expand all
60 gfx::Rect area() const { return area_; } 62 gfx::Rect area() const { return area_; }
61 63
62 // By default copy requests create a new TextureMailbox to return contents 64 // By default copy requests create a new TextureMailbox to return contents
63 // in. This allows a client to provide a TextureMailbox, and the compositor 65 // in. This allows a client to provide a TextureMailbox, and the compositor
64 // will place the result inside the TextureMailbox. 66 // will place the result inside the TextureMailbox.
65 void SetTextureMailbox(const TextureMailbox& texture_mailbox); 67 void SetTextureMailbox(const TextureMailbox& texture_mailbox);
66 bool has_texture_mailbox() const { return has_texture_mailbox_; } 68 bool has_texture_mailbox() const { return has_texture_mailbox_; }
67 const TextureMailbox& texture_mailbox() const { return texture_mailbox_; } 69 const TextureMailbox& texture_mailbox() const { return texture_mailbox_; }
68 70
69 void SendEmptyResult(); 71 void SendEmptyResult();
70 void SendBitmapResult(scoped_ptr<SkBitmap> bitmap); 72 void SendBitmapResult(std::unique_ptr<SkBitmap> bitmap);
71 void SendTextureResult(const gfx::Size& size, 73 void SendTextureResult(
72 const TextureMailbox& texture_mailbox, 74 const gfx::Size& size,
73 scoped_ptr<SingleReleaseCallback> release_callback); 75 const TextureMailbox& texture_mailbox,
76 std::unique_ptr<SingleReleaseCallback> release_callback);
74 77
75 void SendResult(scoped_ptr<CopyOutputResult> result); 78 void SendResult(std::unique_ptr<CopyOutputResult> result);
76 79
77 private: 80 private:
78 CopyOutputRequest(); 81 CopyOutputRequest();
79 CopyOutputRequest(bool force_bitmap_result, 82 CopyOutputRequest(bool force_bitmap_result,
80 const CopyOutputRequestCallback& result_callback); 83 const CopyOutputRequestCallback& result_callback);
81 84
82 void* source_; 85 void* source_;
83 bool force_bitmap_result_; 86 bool force_bitmap_result_;
84 bool has_area_; 87 bool has_area_;
85 bool has_texture_mailbox_; 88 bool has_texture_mailbox_;
86 gfx::Rect area_; 89 gfx::Rect area_;
87 TextureMailbox texture_mailbox_; 90 TextureMailbox texture_mailbox_;
88 CopyOutputRequestCallback result_callback_; 91 CopyOutputRequestCallback result_callback_;
89 }; 92 };
90 93
91 } // namespace cc 94 } // namespace cc
92 95
93 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ 96 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
OLDNEW
« no previous file with comments | « cc/output/compositor_frame_ack.h ('k') | cc/output/copy_output_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698