| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/test_runner/pixel_dump.h" | 5 #include "components/test_runner/pixel_dump.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (!dump_request->callback.is_null()) | 143 if (!dump_request->callback.is_null()) |
| 144 dump_request->callback.Run(bitmap); | 144 dump_request->callback.Run(bitmap); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace | 147 } // namespace |
| 148 | 148 |
| 149 void DumpPixelsAsync(blink::WebView* web_view, | 149 void DumpPixelsAsync(blink::WebView* web_view, |
| 150 const LayoutTestRuntimeFlags& layout_test_runtime_flags, | 150 const LayoutTestRuntimeFlags& layout_test_runtime_flags, |
| 151 float device_scale_factor_for_test, | 151 float device_scale_factor_for_test, |
| 152 const base::Callback<void(const SkBitmap&)>& callback) { | 152 const base::Callback<void(const SkBitmap&)>& callback) { |
| 153 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); | 153 TRACE_EVENT0("shell", "WebViewTestProxyBase::CapturePixelsAsync"); |
| 154 DCHECK(!callback.is_null()); | 154 DCHECK(!callback.is_null()); |
| 155 DCHECK(!layout_test_runtime_flags.dump_drag_image()); | 155 DCHECK(!layout_test_runtime_flags.dump_drag_image()); |
| 156 | 156 |
| 157 std::unique_ptr<PixelsDumpRequest> pixels_request( | 157 std::unique_ptr<PixelsDumpRequest> pixels_request( |
| 158 new PixelsDumpRequest(web_view, layout_test_runtime_flags, callback)); | 158 new PixelsDumpRequest(web_view, layout_test_runtime_flags, callback)); |
| 159 | 159 |
| 160 if (layout_test_runtime_flags.is_printing()) { | 160 if (layout_test_runtime_flags.is_printing()) { |
| 161 base::ThreadTaskRunnerHandle::Get()->PostTask( | 161 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 162 FROM_HERE, base::Bind(&CapturePixelsForPrinting, | 162 FROM_HERE, base::Bind(&CapturePixelsForPrinting, |
| 163 base::Passed(std::move(pixels_request)))); | 163 base::Passed(std::move(pixels_request)))); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 blink::WebImage image = static_cast<blink::WebMockClipboard*>( | 200 blink::WebImage image = static_cast<blink::WebMockClipboard*>( |
| 201 blink::Platform::current()->clipboard()) | 201 blink::Platform::current()->clipboard()) |
| 202 ->readRawImage(blink::WebClipboard::Buffer()); | 202 ->readRawImage(blink::WebClipboard::Buffer()); |
| 203 const SkBitmap& bitmap = image.getSkBitmap(); | 203 const SkBitmap& bitmap = image.getSkBitmap(); |
| 204 SkAutoLockPixels autoLock(bitmap); | 204 SkAutoLockPixels autoLock(bitmap); |
| 205 callback.Run(bitmap); | 205 callback.Run(bitmap); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace test_runner | 208 } // namespace test_runner |
| OLD | NEW |