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

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

Issue 496313004: Remove implicit conversions from scoped_refptr to T* in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 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 scoped_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, 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
« ui/compositor/test/in_process_context_factory.cc ('K') | « ui/gl/gl_image_ref_counted_memory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698