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

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

Issue 2456523004: sync compositor: Implement post metadata to UI (Closed)
Patch Set: rebase Created 4 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
« no previous file with comments | « content/browser/android/synchronous_compositor_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/browser/android/synchronous_compositor_host.h" 5 #include "content/browser/android/synchronous_compositor_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bytes_limit_(0u), 75 bytes_limit_(0u),
76 renderer_param_version_(0u), 76 renderer_param_version_(0u),
77 need_animate_scroll_(false), 77 need_animate_scroll_(false),
78 need_invalidate_count_(0u), 78 need_invalidate_count_(0u),
79 did_activate_pending_tree_count_(0u) { 79 did_activate_pending_tree_count_(0u) {
80 client_->DidInitializeCompositor(this, process_id_, routing_id_); 80 client_->DidInitializeCompositor(this, process_id_, routing_id_);
81 } 81 }
82 82
83 SynchronousCompositorHost::~SynchronousCompositorHost() { 83 SynchronousCompositorHost::~SynchronousCompositorHost() {
84 client_->DidDestroyCompositor(this, process_id_, routing_id_); 84 client_->DidDestroyCompositor(this, process_id_, routing_id_);
85 if (registered_with_filter_) {
86 if (SynchronousCompositorBrowserFilter* filter = GetFilter())
87 filter->UnregisterHost(this);
88 }
85 } 89 }
86 90
87 bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { 91 bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) {
88 bool handled = true; 92 bool handled = true;
89 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message) 93 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message)
90 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_CompositorFrameSinkCreated, 94 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_CompositorFrameSinkCreated,
91 CompositorFrameSinkCreated) 95 CompositorFrameSinkCreated)
92 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) 96 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams)
93 IPC_MESSAGE_UNHANDLED(handled = false) 97 IPC_MESSAGE_UNHANDLED(handled = false)
94 IPC_END_MESSAGE_MAP() 98 IPC_END_MESSAGE_MAP()
95 return handled; 99 return handled;
96 } 100 }
97 101
98 scoped_refptr<SynchronousCompositor::FrameFuture> 102 scoped_refptr<SynchronousCompositor::FrameFuture>
99 SynchronousCompositorHost::DemandDrawHwAsync( 103 SynchronousCompositorHost::DemandDrawHwAsync(
100 const gfx::Size& viewport_size, 104 const gfx::Size& viewport_size,
101 const gfx::Rect& viewport_rect_for_tile_priority, 105 const gfx::Rect& viewport_rect_for_tile_priority,
102 const gfx::Transform& transform_for_tile_priority) { 106 const gfx::Transform& transform_for_tile_priority) {
103 SyncCompositorDemandDrawHwParams params(viewport_size, 107 SyncCompositorDemandDrawHwParams params(viewport_size,
104 viewport_rect_for_tile_priority, 108 viewport_rect_for_tile_priority,
105 transform_for_tile_priority); 109 transform_for_tile_priority);
106 scoped_refptr<FrameFuture> frame_future = new FrameFuture(); 110 scoped_refptr<FrameFuture> frame_future = new FrameFuture();
107 if (SynchronousCompositorBrowserFilter* filter = GetFilter()) { 111 if (SynchronousCompositorBrowserFilter* filter = GetFilter()) {
112 if (!registered_with_filter_) {
113 filter->RegisterHost(this);
114 registered_with_filter_ = true;
115 }
108 filter->SetFrameFuture(routing_id_, frame_future); 116 filter->SetFrameFuture(routing_id_, frame_future);
109 sender_->Send(new SyncCompositorMsg_DemandDrawHwAsync(routing_id_, params)); 117 sender_->Send(new SyncCompositorMsg_DemandDrawHwAsync(routing_id_, params));
110 } else { 118 } else {
111 frame_future->SetFrame(nullptr); 119 frame_future->SetFrame(nullptr);
112 } 120 }
113 return frame_future; 121 return frame_future;
114 } 122 }
115 123
116 SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( 124 SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
117 const gfx::Size& viewport_size, 125 const gfx::Size& viewport_size,
(...skipping 10 matching lines...) Expand all
128 routing_id_, params, &common_renderer_params, 136 routing_id_, params, &common_renderer_params,
129 &compositor_frame_sink_id, &compositor_frame))) { 137 &compositor_frame_sink_id, &compositor_frame))) {
130 return SynchronousCompositor::Frame(); 138 return SynchronousCompositor::Frame();
131 } 139 }
132 140
133 ProcessCommonParams(common_renderer_params); 141 ProcessCommonParams(common_renderer_params);
134 142
135 if (!compositor_frame) 143 if (!compositor_frame)
136 return SynchronousCompositor::Frame(); 144 return SynchronousCompositor::Frame();
137 145
138 return ProcessHardwareFrame(compositor_frame_sink_id,
139 std::move(*compositor_frame));
140 }
141
142 SynchronousCompositor::Frame SynchronousCompositorHost::ProcessHardwareFrame(
143 uint32_t compositor_frame_sink_id,
144 cc::CompositorFrame compositor_frame) {
145 SynchronousCompositor::Frame frame; 146 SynchronousCompositor::Frame frame;
146 frame.frame.reset(new cc::CompositorFrame); 147 frame.frame.reset(new cc::CompositorFrame);
147 frame.compositor_frame_sink_id = compositor_frame_sink_id; 148 frame.compositor_frame_sink_id = compositor_frame_sink_id;
148 *frame.frame = std::move(compositor_frame); 149 *frame.frame = std::move(*compositor_frame);
149 UpdateFrameMetaData(frame.frame->metadata.Clone()); 150 UpdateFrameMetaData(frame.frame->metadata.Clone());
150 return frame; 151 return frame;
151 } 152 }
152 153
153 void SynchronousCompositorHost::UpdateFrameMetaData( 154 void SynchronousCompositorHost::UpdateFrameMetaData(
154 cc::CompositorFrameMetadata frame_metadata) { 155 cc::CompositorFrameMetadata frame_metadata) {
155 rwhva_->SynchronousFrameMetadata(std::move(frame_metadata)); 156 rwhva_->SynchronousFrameMetadata(std::move(frame_metadata));
156 } 157 }
157 158
158 SynchronousCompositorBrowserFilter* SynchronousCompositorHost::GetFilter() { 159 SynchronousCompositorBrowserFilter* SynchronousCompositorHost::GetFilter() {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (params.page_scale_factor) { 413 if (params.page_scale_factor) {
413 client_->UpdateRootLayerState( 414 client_->UpdateRootLayerState(
414 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), 415 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset),
415 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), 416 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset),
416 params.scrollable_size, params.page_scale_factor, 417 params.scrollable_size, params.page_scale_factor,
417 params.min_page_scale_factor, params.max_page_scale_factor); 418 params.min_page_scale_factor, params.max_page_scale_factor);
418 } 419 }
419 } 420 }
420 421
421 } // namespace content 422 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/synchronous_compositor_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698