Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_PROXY_H_ | |
| 6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_PROXY_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "content/common/input/input_event_ack_state.h" | |
| 10 #include "content/renderer/android/synchronous_compositor_external_begin_frame_s ource.h" | |
| 11 #include "content/renderer/android/synchronous_compositor_output_surface.h" | |
| 12 #include "content/renderer/input/input_handler_manager_client.h" | |
| 13 #include "content/renderer/input/synchronous_input_handler_proxy.h" | |
| 14 #include "ui/gfx/geometry/scroll_offset.h" | |
| 15 #include "ui/gfx/geometry/size_f.h" | |
| 16 | |
| 17 namespace IPC { | |
| 18 class Message; | |
| 19 class Sender; | |
| 20 } // namespace IPC | |
| 21 | |
| 22 namespace blink { | |
| 23 class WebInputEvent; | |
| 24 } | |
|
dcheng
2015/11/04 09:47:41
Nit: // namespace blink for consistency
boliu
2015/11/04 16:52:05
Done.
| |
| 25 | |
| 26 namespace cc { | |
| 27 class CompositorFrame; | |
| 28 } // namespace cc | |
| 29 | |
| 30 namespace content { | |
| 31 | |
| 32 class SynchronousCompositorOutputSurface; | |
| 33 struct SyncCompositorCommonBrowserParams; | |
| 34 struct SyncCompositorCommonRendererParams; | |
| 35 struct SyncCompositorDemandDrawHwParams; | |
| 36 | |
| 37 class SynchronousCompositorProxy | |
| 38 : public SynchronousInputHandler, | |
| 39 public SynchronousCompositorExternalBeginFrameSourceClient, | |
| 40 public SynchronousCompositorOutputSurfaceClient { | |
| 41 public: | |
| 42 SynchronousCompositorProxy( | |
| 43 int routing_id, | |
| 44 IPC::Sender* sender, | |
| 45 SynchronousCompositorOutputSurface* output_surface, | |
| 46 SynchronousCompositorExternalBeginFrameSource* begin_frame_source, | |
| 47 SynchronousInputHandlerProxy* input_handler_proxy, | |
| 48 InputHandlerManagerClient::Handler* handler); | |
| 49 ~SynchronousCompositorProxy() override; | |
| 50 | |
| 51 // SynchronousInputHandler overrides. | |
| 52 void SetNeedsSynchronousAnimateInput() override; | |
| 53 void UpdateRootLayerState(const gfx::ScrollOffset& total_scroll_offset, | |
| 54 const gfx::ScrollOffset& max_scroll_offset, | |
| 55 const gfx::SizeF& scrollable_size, | |
| 56 float page_scale_factor, | |
| 57 float min_page_scale_factor, | |
| 58 float max_page_scale_factor) override; | |
| 59 | |
| 60 // SynchronousCompositorExternalBeginFrameSourceClient overrides. | |
| 61 void OnNeedsBeginFramesChange(bool needs_begin_frames) override; | |
| 62 | |
| 63 // SynchronousCompositorOutputSurfaceClient overrides. | |
| 64 void Invalidate() override; | |
| 65 | |
| 66 void OnMessageReceived(const IPC::Message& message); | |
| 67 bool Send(IPC::Message* message); | |
| 68 | |
| 69 private: | |
| 70 void ProcessCommonParams( | |
| 71 const SyncCompositorCommonBrowserParams& common_params); | |
| 72 void ConstructCommonParams(SyncCompositorCommonRendererParams* params); | |
| 73 | |
| 74 // IPC handlers. | |
| 75 void HandleInputEvent( | |
| 76 const SyncCompositorCommonBrowserParams& common_params, | |
| 77 const blink::WebInputEvent* event, | |
| 78 SyncCompositorCommonRendererParams* common_renderer_params, | |
| 79 InputEventAckState* ack); | |
| 80 void BeginFrame(const SyncCompositorCommonBrowserParams& common_params, | |
| 81 const cc::BeginFrameArgs& args, | |
| 82 SyncCompositorCommonRendererParams* common_renderer_params); | |
| 83 void OnComputeScroll( | |
| 84 const SyncCompositorCommonBrowserParams& common_params, | |
| 85 base::TimeTicks animation_time, | |
| 86 SyncCompositorCommonRendererParams* common_renderer_params); | |
| 87 void DemandDrawHw(const SyncCompositorCommonBrowserParams& common_params, | |
| 88 const SyncCompositorDemandDrawHwParams& params, | |
| 89 SyncCompositorCommonRendererParams* common_renderer_params, | |
| 90 cc::CompositorFrame* frame); | |
| 91 | |
| 92 void DidActivatePendingTree(); | |
| 93 void DeliverMessages(); | |
| 94 void SendAsyncRendererStateIfNeeded(); | |
| 95 | |
| 96 const int routing_id_; | |
| 97 IPC::Sender* const sender_; | |
| 98 SynchronousCompositorOutputSurface* const output_surface_; | |
| 99 SynchronousCompositorExternalBeginFrameSource* const begin_frame_source_; | |
| 100 SynchronousInputHandlerProxy* const input_handler_proxy_; | |
| 101 InputHandlerManagerClient::Handler* const input_handler_; | |
| 102 bool inside_receive_; // TODO(boliu): versioning | |
|
dcheng
2015/11/04 09:47:41
Not sure I understand this comment.
boliu
2015/11/04 16:52:05
Just removed this comment.
I think this was a TOD
| |
| 103 | |
| 104 // From browser. | |
| 105 size_t bytes_limit_; | |
| 106 | |
| 107 unsigned version_; | |
| 108 gfx::ScrollOffset total_scroll_offset_; // Modified by both. | |
| 109 gfx::ScrollOffset max_scroll_offset_; | |
| 110 gfx::SizeF scrollable_size_; | |
| 111 float page_scale_factor_; | |
| 112 float min_page_scale_factor_; | |
| 113 float max_page_scale_factor_; | |
| 114 bool need_animate_scroll_; | |
| 115 bool need_invalidate_; | |
| 116 bool need_begin_frame_; | |
| 117 bool did_activate_pending_tree_; | |
| 118 | |
| 119 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorProxy); | |
| 120 }; | |
| 121 | |
| 122 } // namespace content | |
| 123 | |
| 124 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_PROXY_H_ | |
| OLD | NEW |