| 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 "content/browser/renderer_host/offscreen_canvas_surface_impl.h" | 5 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 #include "content/browser/compositor/surface_utils.h" | 10 #include "content/browser/compositor/surface_utils.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 void OffscreenCanvasSurfaceImpl::Create( | 16 void OffscreenCanvasSurfaceImpl::Create( |
| 17 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) { | 17 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) { |
| 18 // |binding_| will take ownership of OffscreenCanvasSurfaceImpl | 18 // |binding_| will take ownership of OffscreenCanvasSurfaceImpl |
| 19 new OffscreenCanvasSurfaceImpl(std::move(request)); | 19 new OffscreenCanvasSurfaceImpl(std::move(request)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( | 22 OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( |
| 23 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) | 23 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurface> request) |
| 24 : id_allocator_(CreateSurfaceIdAllocator()), | 24 : id_allocator_(CreateSurfaceIdAllocator()), |
| 25 binding_(this, std::move(request)) {} | 25 binding_(this, std::move(request)) {} |
| 26 | 26 |
| 27 OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { | 27 OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { |
| 28 if (surface_factory_) { | |
| 29 surface_factory_->DestroyAll(); | |
| 30 } | |
| 31 } | 28 } |
| 32 | 29 |
| 33 void OffscreenCanvasSurfaceImpl::GetSurfaceId( | 30 void OffscreenCanvasSurfaceImpl::GetSurfaceId( |
| 34 const GetSurfaceIdCallback& callback) { | 31 const GetSurfaceIdCallback& callback) { |
| 35 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 32 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 36 | 33 |
| 37 cc::SurfaceId surface_id = id_allocator_->GenerateId(); | 34 cc::SurfaceId surface_id = id_allocator_->GenerateId(); |
| 38 | 35 |
| 39 callback.Run(surface_id); | 36 callback.Run(surface_id); |
| 40 } | 37 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const cc::ReturnedResourceArray& resources) {} | 69 const cc::ReturnedResourceArray& resources) {} |
| 73 | 70 |
| 74 void OffscreenCanvasSurfaceImpl::WillDrawSurface(cc::SurfaceId id, | 71 void OffscreenCanvasSurfaceImpl::WillDrawSurface(cc::SurfaceId id, |
| 75 const gfx::Rect& damage_rect) { | 72 const gfx::Rect& damage_rect) { |
| 76 } | 73 } |
| 77 | 74 |
| 78 void OffscreenCanvasSurfaceImpl::SetBeginFrameSource( | 75 void OffscreenCanvasSurfaceImpl::SetBeginFrameSource( |
| 79 cc::BeginFrameSource* begin_frame_source) {} | 76 cc::BeginFrameSource* begin_frame_source) {} |
| 80 | 77 |
| 81 } // namespace content | 78 } // namespace content |
| OLD | NEW |