| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 resource_id); | 181 resource_id); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace | 185 } // namespace |
| 186 | 186 |
| 187 void OffscreenCanvasFrameDispatcherImpl::PostImageToPlaceholder( | 187 void OffscreenCanvasFrameDispatcherImpl::PostImageToPlaceholder( |
| 188 RefPtr<StaticBitmapImage> image) { | 188 RefPtr<StaticBitmapImage> image) { |
| 189 // After this point, |image| can only be used on the main thread, until | 189 // After this point, |image| can only be used on the main thread, until |
| 190 // it is returned. | 190 // it is returned. |
| 191 image->Transfer(); | |
| 192 RefPtr<WebTaskRunner> dispatcher_task_runner = | 191 RefPtr<WebTaskRunner> dispatcher_task_runner = |
| 193 Platform::Current()->CurrentThread()->GetWebTaskRunner(); | 192 Platform::Current()->CurrentThread()->GetWebTaskRunner(); |
| 194 | 193 |
| 195 Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( | 194 Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( |
| 196 BLINK_FROM_HERE, | 195 BLINK_FROM_HERE, |
| 197 CrossThreadBind(UpdatePlaceholderImage, this->CreateWeakPtr(), | 196 CrossThreadBind(UpdatePlaceholderImage, this->CreateWeakPtr(), |
| 198 WTF::Passed(std::move(dispatcher_task_runner)), | 197 WTF::Passed(std::move(dispatcher_task_runner)), |
| 199 placeholder_canvas_id_, std::move(image), | 198 placeholder_canvas_id_, std::move(image), |
| 200 next_resource_id_)); | 199 next_resource_id_)); |
| 201 spare_resource_locks_.insert(next_resource_id_); | 200 spare_resource_locks_.insert(next_resource_id_); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 491 |
| 493 void OffscreenCanvasFrameDispatcherImpl::Reshape(int width, int height) { | 492 void OffscreenCanvasFrameDispatcherImpl::Reshape(int width, int height) { |
| 494 if (width_ != width || height_ != height) { | 493 if (width_ != width || height_ != height) { |
| 495 width_ = width; | 494 width_ = width; |
| 496 height_ = height; | 495 height_ = height; |
| 497 change_size_for_next_commit_ = true; | 496 change_size_for_next_commit_ = true; |
| 498 } | 497 } |
| 499 } | 498 } |
| 500 | 499 |
| 501 } // namespace blink | 500 } // namespace blink |
| OLD | NEW |