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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.h

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "cc/input/layer_scroll_offset_delegate.h" 13 #include "cc/input/layer_scroll_offset_delegate.h"
14 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h" 14 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
15 #include "content/common/input/input_event_ack_state.h" 15 #include "content/common/input/input_event_ack_state.h"
16 #include "content/public/browser/android/synchronous_compositor.h" 16 #include "content/public/browser/android/synchronous_compositor.h"
17 #include "content/public/browser/web_contents_user_data.h" 17 #include "content/public/browser/web_contents_user_data.h"
18 #include "ipc/ipc_message.h" 18 #include "ipc/ipc_message.h"
19 19
20 namespace cc { 20 namespace cc {
21 class BeginFrameSource;
21 class InputHandler; 22 class InputHandler;
22 } 23 }
23 24
24 namespace blink { 25 namespace blink {
25 class WebInputEvent; 26 class WebInputEvent;
26 } 27 }
27 28
28 namespace content { 29 namespace content {
29 class InputHandlerManager; 30 class InputHandlerManager;
31 class SynchronousCompositorExternalBeginFrameSource;
30 struct DidOverscrollParams; 32 struct DidOverscrollParams;
31 33
32 // The purpose of this class is to act as the intermediary between the various 34 // The purpose of this class is to act as the intermediary between the various
33 // components that make up the 'synchronous compositor mode' implementation and 35 // components that make up the 'synchronous compositor mode' implementation and
34 // expose their functionality via the SynchronousCompositor interface. 36 // expose their functionality via the SynchronousCompositor interface.
35 // This class is created on the main thread but most of the APIs are called 37 // This class is created on the main thread but most of the APIs are called
36 // from the Compositor thread. 38 // from the Compositor thread.
37 class SynchronousCompositorImpl 39 class SynchronousCompositorImpl
38 : public cc::LayerScrollOffsetDelegate, 40 : public cc::LayerScrollOffsetDelegate,
39 public SynchronousCompositor, 41 public SynchronousCompositor,
40 public SynchronousCompositorOutputSurfaceDelegate, 42 public SynchronousCompositorOutputSurfaceDelegate,
41 public WebContentsUserData<SynchronousCompositorImpl> { 43 public WebContentsUserData<SynchronousCompositorImpl> {
42 public: 44 public:
43 // When used from browser code, use both |process_id| and |routing_id|. 45 // When used from browser code, use both |process_id| and |routing_id|.
44 static SynchronousCompositorImpl* FromID(int process_id, int routing_id); 46 static SynchronousCompositorImpl* FromID(int process_id, int routing_id);
45 // When handling upcalls from renderer code, use this version; the process id 47 // When handling upcalls from renderer code, use this version; the process id
46 // is implicitly that of the in-process renderer. 48 // is implicitly that of the in-process renderer.
47 static SynchronousCompositorImpl* FromRoutingID(int routing_id); 49 static SynchronousCompositorImpl* FromRoutingID(int routing_id);
48 50
49 InputEventAckState HandleInputEvent(const blink::WebInputEvent& input_event); 51 InputEventAckState HandleInputEvent(const blink::WebInputEvent& input_event);
50 52
53 void DidInitializeExternalBeginFrameSource(
54 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
55 void DidDestroyExternalBeginFrameSource(
56 SynchronousCompositorExternalBeginFrameSource* begin_frame_source);
57 void NeedsBeginFramesChanged() const;
58
51 // SynchronousCompositor 59 // SynchronousCompositor
52 virtual void SetClient(SynchronousCompositorClient* compositor_client) 60 virtual void SetClient(SynchronousCompositorClient* compositor_client)
53 override; 61 override;
54 virtual bool InitializeHwDraw() override; 62 virtual bool InitializeHwDraw() override;
55 virtual void ReleaseHwDraw() override; 63 virtual void ReleaseHwDraw() override;
56 virtual scoped_ptr<cc::CompositorFrame> DemandDrawHw( 64 virtual scoped_ptr<cc::CompositorFrame> DemandDrawHw(
57 gfx::Size surface_size, 65 gfx::Size surface_size,
58 const gfx::Transform& transform, 66 const gfx::Transform& transform,
59 gfx::Rect viewport, 67 gfx::Rect viewport,
60 gfx::Rect clip, 68 gfx::Rect clip,
61 gfx::Rect viewport_rect_for_tile_priority, 69 gfx::Rect viewport_rect_for_tile_priority,
62 const gfx::Transform& transform_for_tile_priority) override; 70 const gfx::Transform& transform_for_tile_priority) override;
63 virtual bool DemandDrawSw(SkCanvas* canvas) override; 71 virtual bool DemandDrawSw(SkCanvas* canvas) override;
64 virtual void ReturnResources( 72 virtual void ReturnResources(
65 const cc::CompositorFrameAck& frame_ack) override; 73 const cc::CompositorFrameAck& frame_ack) override;
66 virtual void SetMemoryPolicy(size_t bytes_limit) override; 74 virtual void SetMemoryPolicy(size_t bytes_limit) override;
67 virtual void DidChangeRootLayerScrollOffset() override; 75 virtual void DidChangeRootLayerScrollOffset() override;
68 76
69 // SynchronousCompositorOutputSurfaceDelegate 77 // SynchronousCompositorOutputSurfaceDelegate
70 virtual void DidBindOutputSurface( 78 virtual void DidBindOutputSurface(
71 SynchronousCompositorOutputSurface* output_surface) override; 79 SynchronousCompositorOutputSurface* output_surface) override;
72 virtual void DidDestroySynchronousOutputSurface( 80 virtual void DidDestroySynchronousOutputSurface(
73 SynchronousCompositorOutputSurface* output_surface) override; 81 SynchronousCompositorOutputSurface* output_surface) override;
74 virtual void SetContinuousInvalidate(bool enable) override;
75 virtual void DidActivatePendingTree() override; 82 virtual void DidActivatePendingTree() override;
76 83
77 // LayerScrollOffsetDelegate 84 // LayerScrollOffsetDelegate
78 virtual gfx::ScrollOffset GetTotalScrollOffset() override; 85 virtual gfx::ScrollOffset GetTotalScrollOffset() override;
79 virtual void UpdateRootLayerState( 86 virtual void UpdateRootLayerState(
80 const gfx::ScrollOffset& total_scroll_offset, 87 const gfx::ScrollOffset& total_scroll_offset,
81 const gfx::ScrollOffset& max_scroll_offset, 88 const gfx::ScrollOffset& max_scroll_offset,
82 const gfx::SizeF& scrollable_size, 89 const gfx::SizeF& scrollable_size,
83 float page_scale_factor, 90 float page_scale_factor,
84 float min_page_scale_factor, 91 float min_page_scale_factor,
85 float max_page_scale_factor) override; 92 float max_page_scale_factor) override;
86 virtual bool IsExternalFlingActive() const override; 93 virtual bool IsExternalFlingActive() const override;
87 94
88 void SetInputHandler(cc::InputHandler* input_handler); 95 void SetInputHandler(cc::InputHandler* input_handler);
89 void DidOverscroll(const DidOverscrollParams& params); 96 void DidOverscroll(const DidOverscrollParams& params);
90 void DidStopFlinging(); 97 void DidStopFlinging();
91 98
92 private: 99 private:
93 explicit SynchronousCompositorImpl(WebContents* contents); 100 explicit SynchronousCompositorImpl(WebContents* contents);
94 virtual ~SynchronousCompositorImpl(); 101 virtual ~SynchronousCompositorImpl();
95 friend class WebContentsUserData<SynchronousCompositorImpl>; 102 friend class WebContentsUserData<SynchronousCompositorImpl>;
96 103
97 void UpdateFrameMetaData(const cc::CompositorFrameMetadata& frame_info); 104 void UpdateFrameMetaData(const cc::CompositorFrameMetadata& frame_info);
105 void NotifyDidDestroyCompositorToClient();
98 void DeliverMessages(); 106 void DeliverMessages();
99 bool CalledOnValidThread() const; 107 bool CalledOnValidThread() const;
100 108
101 SynchronousCompositorClient* compositor_client_; 109 SynchronousCompositorClient* compositor_client_;
102 SynchronousCompositorOutputSurface* output_surface_; 110 SynchronousCompositorOutputSurface* output_surface_;
111 SynchronousCompositorExternalBeginFrameSource* begin_frame_source_;
103 WebContents* contents_; 112 WebContents* contents_;
104 cc::InputHandler* input_handler_; 113 cc::InputHandler* input_handler_;
114 bool invoking_composite_;
105 115
106 base::WeakPtrFactory<SynchronousCompositorImpl> weak_ptr_factory_; 116 base::WeakPtrFactory<SynchronousCompositorImpl> weak_ptr_factory_;
107 117
108 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl); 118 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorImpl);
109 }; 119 };
110 120
111 } // namespace content 121 } // namespace content
112 122
113 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_ 123 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698