Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_provider_impl.cc

Issue 2644653003: Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate (Closed)
Patch Set: rebase again Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_compositor_frame_sink_p rovider_impl.h" 5 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_p rovider_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "content/browser/compositor/surface_utils.h" 8 #include "content/browser/compositor/surface_utils.h"
9 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.h " 9 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.h "
10 #include "content/browser/renderer_host/offscreen_canvas_surface_manager.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 OffscreenCanvasCompositorFrameSinkProviderImpl:: 15 OffscreenCanvasCompositorFrameSinkProviderImpl::
15 OffscreenCanvasCompositorFrameSinkProviderImpl() {} 16 OffscreenCanvasCompositorFrameSinkProviderImpl() {}
16 17
17 OffscreenCanvasCompositorFrameSinkProviderImpl:: 18 OffscreenCanvasCompositorFrameSinkProviderImpl::
18 ~OffscreenCanvasCompositorFrameSinkProviderImpl() {} 19 ~OffscreenCanvasCompositorFrameSinkProviderImpl() {}
19 20
20 void OffscreenCanvasCompositorFrameSinkProviderImpl::Add( 21 void OffscreenCanvasCompositorFrameSinkProviderImpl::Add(
21 blink::mojom::OffscreenCanvasCompositorFrameSinkProviderRequest request) { 22 blink::mojom::OffscreenCanvasCompositorFrameSinkProviderRequest request) {
22 bindings_.AddBinding(this, std::move(request)); 23 bindings_.AddBinding(this, std::move(request));
23 } 24 }
24 25
25 void OffscreenCanvasCompositorFrameSinkProviderImpl::CreateCompositorFrameSink( 26 void OffscreenCanvasCompositorFrameSinkProviderImpl::CreateCompositorFrameSink(
26 const cc::FrameSinkId& frame_sink_id, 27 const cc::FrameSinkId& frame_sink_id,
27 cc::mojom::MojoCompositorFrameSinkClientPtr client, 28 cc::mojom::MojoCompositorFrameSinkClientPtr client,
28 cc::mojom::MojoCompositorFrameSinkRequest request) { 29 cc::mojom::MojoCompositorFrameSinkRequest request) {
29 compositor_frame_sinks_[frame_sink_id] = 30 compositor_frame_sinks_[frame_sink_id] =
30 base::MakeUnique<OffscreenCanvasCompositorFrameSink>( 31 base::MakeUnique<OffscreenCanvasCompositorFrameSink>(
31 this, frame_sink_id, std::move(request), std::move(client)); 32 this, frame_sink_id, std::move(request), std::move(client));
33
34 OffscreenCanvasSurfaceManager::GetInstance()->RegisterFrameSinkToParent(
35 frame_sink_id);
32 } 36 }
33 37
34 cc::SurfaceManager* 38 cc::SurfaceManager*
35 OffscreenCanvasCompositorFrameSinkProviderImpl::GetSurfaceManager() { 39 OffscreenCanvasCompositorFrameSinkProviderImpl::GetSurfaceManager() {
36 return content::GetSurfaceManager(); 40 return content::GetSurfaceManager();
37 } 41 }
38 42
39 void OffscreenCanvasCompositorFrameSinkProviderImpl:: 43 void OffscreenCanvasCompositorFrameSinkProviderImpl::
40 OnCompositorFrameSinkClientConnectionLost( 44 OnCompositorFrameSinkClientConnectionLost(
41 const cc::FrameSinkId& frame_sink_id) { 45 const cc::FrameSinkId& frame_sink_id) {
46 // TODO(fsamuel, xlai): Investigate why this function is not fired when user
47 // close down the window that has OffscreenCanvas commit().
42 compositor_frame_sinks_.erase(frame_sink_id); 48 compositor_frame_sinks_.erase(frame_sink_id);
43 } 49 }
44 50
51 void OffscreenCanvasCompositorFrameSinkProviderImpl::
52 OnCompositorFrameSinkClientDestroyed(const cc::FrameSinkId& frame_sink_id) {
53 OffscreenCanvasSurfaceManager::GetInstance()->UnregisterFrameSinkFromParent(
54 frame_sink_id);
55 }
56
45 } // namespace content 57 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698