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" |
(...skipping 11 matching lines...) Expand all Loading... |
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 (!GetSurfaceManager()) { | 28 if (!GetSurfaceManager()) { |
29 // Inform both members that SurfaceManager's no longer alive to | 29 // Inform both members that SurfaceManager's no longer alive to |
30 // avoid their destruction errors. | 30 // avoid their destruction errors. |
31 if (surface_factory_) | 31 if (surface_factory_) |
32 surface_factory_->didDestroySurfaceManager(); | 32 surface_factory_->DidDestroySurfaceManager(); |
33 if (id_allocator_) | 33 if (id_allocator_) |
34 id_allocator_->didDestroySurfaceManager(); | 34 id_allocator_->DidDestroySurfaceManager(); |
35 } | 35 } |
36 surface_factory_->Destroy(surface_id_); | 36 surface_factory_->Destroy(surface_id_); |
37 } | 37 } |
38 | 38 |
39 void OffscreenCanvasSurfaceImpl::GetSurfaceId( | 39 void OffscreenCanvasSurfaceImpl::GetSurfaceId( |
40 const GetSurfaceIdCallback& callback) { | 40 const GetSurfaceIdCallback& callback) { |
41 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 41 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
42 | 42 |
43 surface_id_ = id_allocator_->GenerateId(); | 43 surface_id_ = id_allocator_->GenerateId(); |
44 | 44 |
(...skipping 25 matching lines...) Expand all Loading... |
70 sequences.push_back(sequence.sequence); | 70 sequences.push_back(sequence.sequence); |
71 cc::SurfaceManager* manager = GetSurfaceManager(); | 71 cc::SurfaceManager* manager = GetSurfaceManager(); |
72 manager->DidSatisfySequences(sequence.id_namespace, &sequences); | 72 manager->DidSatisfySequences(sequence.id_namespace, &sequences); |
73 } | 73 } |
74 | 74 |
75 // TODO(619136): Implement cc::SurfaceFactoryClient functions for resources | 75 // TODO(619136): Implement cc::SurfaceFactoryClient functions for resources |
76 // return. | 76 // return. |
77 void OffscreenCanvasSurfaceImpl::ReturnResources( | 77 void OffscreenCanvasSurfaceImpl::ReturnResources( |
78 const cc::ReturnedResourceArray& resources) {} | 78 const cc::ReturnedResourceArray& resources) {} |
79 | 79 |
80 void OffscreenCanvasSurfaceImpl::WillDrawSurface(cc::SurfaceId id, | 80 void OffscreenCanvasSurfaceImpl::WillDrawSurface(const cc::SurfaceId& id, |
81 const gfx::Rect& damage_rect) { | 81 const gfx::Rect& damage_rect) { |
82 } | 82 } |
83 | 83 |
84 void OffscreenCanvasSurfaceImpl::SetBeginFrameSource( | 84 void OffscreenCanvasSurfaceImpl::SetBeginFrameSource( |
85 cc::BeginFrameSource* begin_frame_source) {} | 85 cc::BeginFrameSource* begin_frame_source) {} |
86 | 86 |
87 } // namespace content | 87 } // namespace content |
OLD | NEW |