OLD | NEW |
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 Loading... |
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 |
OLD | NEW |