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 "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" | 5 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" |
6 | 6 |
7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
8 #include "cc/quads/texture_draw_quad.h" | 8 #include "cc/quads/texture_draw_quad.h" |
9 #include "gpu/command_buffer/client/gles2_interface.h" | 9 #include "gpu/command_buffer/client/gles2_interface.h" |
10 #include "platform/CrossThreadFunctional.h" | 10 #include "platform/CrossThreadFunctional.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Hold ref to |image|, to keep it alive until the browser ReclaimResources. | 157 // Hold ref to |image|, to keep it alive until the browser ReclaimResources. |
158 // It guarantees that the resource is not re-used or deleted. | 158 // It guarantees that the resource is not re-used or deleted. |
159 m_cachedImages.add(m_nextResourceId, std::move(image)); | 159 m_cachedImages.add(m_nextResourceId, std::move(image)); |
160 } | 160 } |
161 | 161 |
162 namespace { | 162 namespace { |
163 | 163 |
164 void updatePlaceholderImage(WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher, | 164 void updatePlaceholderImage(WeakPtr<OffscreenCanvasFrameDispatcher> dispatcher, |
165 std::unique_ptr<WebTaskRunner> taskRunner, | 165 std::unique_ptr<WebTaskRunner> taskRunner, |
166 int placeholderCanvasId, | 166 int placeholderCanvasId, |
167 RefPtr<blink::Image> image, | 167 RefPtr<blink::StaticBitmapImage> image, |
168 unsigned resourceId) { | 168 unsigned resourceId) { |
169 DCHECK(isMainThread()); | 169 DCHECK(isMainThread()); |
170 OffscreenCanvasPlaceholder* placeholderCanvas = | 170 OffscreenCanvasPlaceholder* placeholderCanvas = |
171 OffscreenCanvasPlaceholder::getPlaceholderById(placeholderCanvasId); | 171 OffscreenCanvasPlaceholder::getPlaceholderById(placeholderCanvasId); |
172 if (placeholderCanvas) { | 172 if (placeholderCanvas) { |
173 placeholderCanvas->setPlaceholderFrame(std::move(image), | 173 placeholderCanvas->setPlaceholderFrame(std::move(image), |
174 std::move(dispatcher), | 174 std::move(dispatcher), |
175 std::move(taskRunner), resourceId); | 175 std::move(taskRunner), resourceId); |
176 } | 176 } |
177 } | 177 } |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return true; | 409 return true; |
410 return false; | 410 return false; |
411 } | 411 } |
412 | 412 |
413 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 413 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
414 m_width = width; | 414 m_width = width; |
415 m_height = height; | 415 m_height = height; |
416 } | 416 } |
417 | 417 |
418 } // namespace blink | 418 } // namespace blink |
OLD | NEW |