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

Side by Side Diff: content/browser/android/synchronous_compositor_host.h

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: Code review Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 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 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_SYNCHRONOUS_COMPOSITOR_HOST_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_HOST_H_
6 #define CONTENT_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_HOST_H_ 6 #define CONTENT_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "cc/output/compositor_frame.h" 17 #include "cc/output/compositor_frame.h"
17 #include "content/common/input/input_event_ack_state.h" 18 #include "content/common/input/input_event_ack_state.h"
18 #include "content/public/browser/android/synchronous_compositor.h" 19 #include "content/public/browser/android/synchronous_compositor.h"
19 #include "ui/gfx/geometry/scroll_offset.h" 20 #include "ui/gfx/geometry/scroll_offset.h"
20 #include "ui/gfx/geometry/size_f.h" 21 #include "ui/gfx/geometry/size_f.h"
21 22
22 namespace IPC { 23 namespace IPC {
23 class Message; 24 class Message;
(...skipping 23 matching lines...) Expand all
47 48
48 class SynchronousCompositorHost : public SynchronousCompositor { 49 class SynchronousCompositorHost : public SynchronousCompositor {
49 public: 50 public:
50 static std::unique_ptr<SynchronousCompositorHost> Create( 51 static std::unique_ptr<SynchronousCompositorHost> Create(
51 RenderWidgetHostViewAndroid* rwhva, 52 RenderWidgetHostViewAndroid* rwhva,
52 WebContents* web_contents); 53 WebContents* web_contents);
53 54
54 ~SynchronousCompositorHost() override; 55 ~SynchronousCompositorHost() override;
55 56
56 // SynchronousCompositor overrides. 57 // SynchronousCompositor overrides.
57 SynchronousCompositor::Frame DemandDrawHw( 58 scoped_refptr<SynchronousCompositor::FrameFuture> DemandDrawHw(
58 const gfx::Size& viewport_size, 59 const gfx::Size& viewport_size,
59 const gfx::Rect& viewport_rect_for_tile_priority, 60 const gfx::Rect& viewport_rect_for_tile_priority,
60 const gfx::Transform& transform_for_tile_priority) override; 61 const gfx::Transform& transform_for_tile_priority) override;
61 void DemandDrawHwAsync( 62 scoped_refptr<SynchronousCompositor::FrameFuture> DemandDrawHwAsync(
boliu 2016/09/20 00:27:56 leave this void for now, if you are not using the
ojars 2016/09/22 18:21:38 Done.
62 const gfx::Size& viewport_size, 63 const gfx::Size& viewport_size,
63 const gfx::Rect& viewport_rect_for_tile_priority, 64 const gfx::Rect& viewport_rect_for_tile_priority,
64 const gfx::Transform& transform_for_tile_priority) override; 65 const gfx::Transform& transform_for_tile_priority) override;
65 bool DemandDrawSw(SkCanvas* canvas) override; 66 bool DemandDrawSw(SkCanvas* canvas) override;
66 void ReturnResources(uint32_t compositor_frame_sink_id, 67 void ReturnResources(uint32_t compositor_frame_sink_id,
67 const cc::ReturnedResourceArray& resources) override; 68 const cc::ReturnedResourceArray& resources) override;
68 void SetMemoryPolicy(size_t bytes_limit) override; 69 void SetMemoryPolicy(size_t bytes_limit) override;
69 void DidChangeRootLayerScrollOffset( 70 void DidChangeRootLayerScrollOffset(
70 const gfx::ScrollOffset& root_offset) override; 71 const gfx::ScrollOffset& root_offset) override;
71 void SynchronouslyZoomBy(float zoom_delta, const gfx::Point& anchor) override; 72 void SynchronouslyZoomBy(float zoom_delta, const gfx::Point& anchor) override;
(...skipping 16 matching lines...) Expand all
88 friend class SynchronousCompositorBase; 89 friend class SynchronousCompositorBase;
89 90
90 SynchronousCompositorHost(RenderWidgetHostViewAndroid* rwhva, 91 SynchronousCompositorHost(RenderWidgetHostViewAndroid* rwhva,
91 SynchronousCompositorClient* client, 92 SynchronousCompositorClient* client,
92 bool use_in_proc_software_draw); 93 bool use_in_proc_software_draw);
93 void UpdateFrameMetaData(cc::CompositorFrameMetadata frame_metadata); 94 void UpdateFrameMetaData(cc::CompositorFrameMetadata frame_metadata);
94 void CompositorFrameSinkCreated(); 95 void CompositorFrameSinkCreated();
95 bool DemandDrawSwInProc(SkCanvas* canvas); 96 bool DemandDrawSwInProc(SkCanvas* canvas);
96 void SetSoftwareDrawSharedMemoryIfNeeded(size_t stride, size_t buffer_size); 97 void SetSoftwareDrawSharedMemoryIfNeeded(size_t stride, size_t buffer_size);
97 void SendZeroMemory(); 98 void SendZeroMemory();
98 SynchronousCompositor::Frame ProcessHardwareFrame( 99 std::unique_ptr<SynchronousCompositor::Frame> ProcessHardwareFrame(
99 uint32_t compositor_frame_sink_id, 100 uint32_t compositor_frame_sink_id,
100 cc::CompositorFrame compositor_frame); 101 cc::CompositorFrame compositor_frame);
101 bool DemandDrawHwReceiveFrame(const IPC::Message& message); 102 bool DemandDrawHwReceiveFrame(const IPC::Message& message);
102 103
103 RenderWidgetHostViewAndroid* const rwhva_; 104 RenderWidgetHostViewAndroid* const rwhva_;
104 SynchronousCompositorClient* const client_; 105 SynchronousCompositorClient* const client_;
105 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 106 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
106 const int process_id_; 107 const int process_id_;
107 const int routing_id_; 108 const int routing_id_;
108 SynchronousCompositorObserver* const rph_observer_; 109 SynchronousCompositorObserver* const rph_observer_;
109 IPC::Sender* const sender_; 110 IPC::Sender* const sender_;
110 const bool use_in_process_zero_copy_software_draw_; 111 const bool use_in_process_zero_copy_software_draw_;
111 112
112 size_t bytes_limit_; 113 size_t bytes_limit_;
113 std::unique_ptr<SharedMemoryWithSize> software_draw_shm_; 114 std::unique_ptr<SharedMemoryWithSize> software_draw_shm_;
115 scoped_refptr<SynchronousCompositor::FrameFuture> frame_future_;
boliu 2016/09/20 00:27:56 you don't need this
ojars 2016/09/22 18:21:39 Done.
114 116
115 // Updated by both renderer and browser. 117 // Updated by both renderer and browser.
116 gfx::ScrollOffset root_scroll_offset_; 118 gfx::ScrollOffset root_scroll_offset_;
117 119
118 // From renderer. 120 // From renderer.
119 uint32_t renderer_param_version_; 121 uint32_t renderer_param_version_;
120 bool need_animate_scroll_; 122 bool need_animate_scroll_;
121 uint32_t need_invalidate_count_; 123 uint32_t need_invalidate_count_;
122 uint32_t did_activate_pending_tree_count_; 124 uint32_t did_activate_pending_tree_count_;
123 125
124 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorHost); 126 DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorHost);
125 }; 127 };
126 128
127 } // namespace content 129 } // namespace content
128 130
129 #endif // CONTENT_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_HOST_H_ 131 #endif // CONTENT_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698