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

Side by Side Diff: ui/snapshot/snapshot_async.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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 | « ui/snapshot/snapshot_async.h ('k') | ui/snapshot/snapshot_aura.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/snapshot/snapshot_async.h" 5 #include "ui/snapshot/snapshot_async.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 return png_data; 57 return png_data;
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 void SnapshotAsync::ScaleCopyOutputResult( 62 void SnapshotAsync::ScaleCopyOutputResult(
63 const GrabWindowSnapshotAsyncCallback& callback, 63 const GrabWindowSnapshotAsyncCallback& callback,
64 const gfx::Size& target_size, 64 const gfx::Size& target_size,
65 scoped_refptr<base::TaskRunner> background_task_runner, 65 scoped_refptr<base::TaskRunner> background_task_runner,
66 scoped_ptr<cc::CopyOutputResult> result) { 66 std::unique_ptr<cc::CopyOutputResult> result) {
67 if (result->IsEmpty()) { 67 if (result->IsEmpty()) {
68 callback.Run(gfx::Image()); 68 callback.Run(gfx::Image());
69 return; 69 return;
70 } 70 }
71 71
72 // TODO(sergeyu): Potentially images can be scaled on GPU before reading it 72 // TODO(sergeyu): Potentially images can be scaled on GPU before reading it
73 // from GPU. Image scaling is implemented in content::GlHelper, but it's can't 73 // from GPU. Image scaling is implemented in content::GlHelper, but it's can't
74 // be used here because it's not in content/public. Move the scaling code 74 // be used here because it's not in content/public. Move the scaling code
75 // somewhere so that it can be reused here. 75 // somewhere so that it can be reused here.
76 base::PostTaskAndReplyWithResult( 76 base::PostTaskAndReplyWithResult(
77 background_task_runner.get(), 77 background_task_runner.get(),
78 FROM_HERE, 78 FROM_HERE,
79 base::Bind(ScaleBitmap, *result->TakeBitmap(), target_size), 79 base::Bind(ScaleBitmap, *result->TakeBitmap(), target_size),
80 base::Bind(&OnFrameScalingFinished, callback)); 80 base::Bind(&OnFrameScalingFinished, callback));
81 } 81 }
82 82
83 void SnapshotAsync::EncodeCopyOutputResult( 83 void SnapshotAsync::EncodeCopyOutputResult(
84 const GrabWindowSnapshotAsyncPNGCallback& callback, 84 const GrabWindowSnapshotAsyncPNGCallback& callback,
85 scoped_refptr<base::TaskRunner> background_task_runner, 85 scoped_refptr<base::TaskRunner> background_task_runner,
86 scoped_ptr<cc::CopyOutputResult> result) { 86 std::unique_ptr<cc::CopyOutputResult> result) {
87 if (result->IsEmpty()) { 87 if (result->IsEmpty()) {
88 callback.Run(scoped_refptr<base::RefCountedBytes>()); 88 callback.Run(scoped_refptr<base::RefCountedBytes>());
89 return; 89 return;
90 } 90 }
91 91
92 // TODO(sergeyu): Potentially images can be scaled on GPU before reading it 92 // TODO(sergeyu): Potentially images can be scaled on GPU before reading it
93 // from GPU. Image scaling is implemented in content::GlHelper, but it's can't 93 // from GPU. Image scaling is implemented in content::GlHelper, but it's can't
94 // be used here because it's not in content/public. Move the scaling code 94 // be used here because it's not in content/public. Move the scaling code
95 // somewhere so that it can be reused here. 95 // somewhere so that it can be reused here.
96 base::PostTaskAndReplyWithResult( 96 base::PostTaskAndReplyWithResult(
97 background_task_runner.get(), 97 background_task_runner.get(),
98 FROM_HERE, 98 FROM_HERE,
99 base::Bind(EncodeBitmap, *result->TakeBitmap()), 99 base::Bind(EncodeBitmap, *result->TakeBitmap()),
100 callback); 100 callback);
101 } 101 }
102 102
103 } // namespace ui 103 } // namespace ui
OLDNEW
« no previous file with comments | « ui/snapshot/snapshot_async.h ('k') | ui/snapshot/snapshot_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698