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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 2317753002: cc: Abstract the LayerTreeHost. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index ba84bab51851e94b71d20aa81c34996d5144b7d5..bc11de06410d90945342fee45be1d815d34eb01c 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -129,7 +129,7 @@ LayerTreeHost::InitParams::InitParams() {
LayerTreeHost::InitParams::~InitParams() {
}
-std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
+std::unique_ptr<LayerTreeHostInterface> LayerTreeHost::CreateThreaded(
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
InitParams* params) {
DCHECK(params->main_task_runner.get());
@@ -140,7 +140,7 @@ std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
layer_tree_host->InitializeThreaded(
params->main_task_runner, impl_task_runner,
std::move(params->external_begin_frame_source));
- return layer_tree_host;
+ return std::move(layer_tree_host);
}
std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
@@ -155,7 +155,7 @@ std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
return layer_tree_host;
}
-std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteServer(
+std::unique_ptr<LayerTreeHostInterface> LayerTreeHost::CreateRemoteServer(
RemoteProtoChannel* remote_proto_channel,
InitParams* params) {
DCHECK(params->main_task_runner.get());
@@ -173,10 +173,10 @@ std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteServer(
new LayerTreeHost(params, CompositorMode::REMOTE));
layer_tree_host->InitializeRemoteServer(remote_proto_channel,
params->main_task_runner);
- return layer_tree_host;
+ return std::move(layer_tree_host);
}
-std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteClient(
+std::unique_ptr<LayerTreeHostInterface> LayerTreeHost::CreateRemoteClient(
RemoteProtoChannel* remote_proto_channel,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
InitParams* params) {
@@ -195,7 +195,7 @@ std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteClient(
new LayerTreeHost(params, CompositorMode::REMOTE));
layer_tree_host->InitializeRemoteClient(
remote_proto_channel, params->main_task_runner, impl_task_runner);
- return layer_tree_host;
+ return std::move(layer_tree_host);
}
LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode)
@@ -358,9 +358,33 @@ LayerTreeHost::~LayerTreeHost() {
}
}
+int LayerTreeHost::GetId() const {
+ return id_;
+}
+
+int LayerTreeHost::SourceFrameNumber() const {
+ return source_frame_number_;
+}
+
+LayerTree* LayerTreeHost::GetLayerTree() {
+ return layer_tree_.get();
+}
+
+const LayerTree* LayerTreeHost::GetLayerTree() const {
+ return layer_tree_.get();
+}
+
+TaskRunnerProvider* LayerTreeHost::GetTaskRunnerProvider() const {
+ return task_runner_provider_.get();
+}
+
+const LayerTreeSettings& LayerTreeHost::GetSettings() const {
+ return settings_;
+}
+
void LayerTreeHost::WillBeginMainFrame() {
- devtools_instrumentation::WillBeginMainThreadFrame(id(),
- source_frame_number());
+ devtools_instrumentation::WillBeginMainThreadFrame(GetId(),
+ SourceFrameNumber());
client_->WillBeginMainFrame();
}
@@ -380,6 +404,10 @@ void LayerTreeHost::DidStopFlinging() {
proxy_->MainThreadHasStoppedFlinging();
}
+const LayerTreeDebugState& LayerTreeHost::GetDebugState() const {
+ return debug_state_;
+}
+
void LayerTreeHost::RequestMainFrameUpdate() {
client_->UpdateLayerTreeHost();
}
@@ -409,7 +437,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
next_commit_forces_redraw_ = false;
}
- sync_tree->set_source_frame_number(source_frame_number());
+ sync_tree->set_source_frame_number(SourceFrameNumber());
if (layer_tree_->needs_full_tree_sync())
TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree);
@@ -647,6 +675,10 @@ void LayerTreeHost::SetVisible(bool visible) {
proxy_->SetVisible(visible);
}
+bool LayerTreeHost::IsVisible() const {
+ return visible_;
+}
+
void LayerTreeHost::NotifyInputThrottledUntilCommit() {
proxy_->NotifyInputThrottledUntilCommit();
}
@@ -723,7 +755,7 @@ void LayerTreeHost::BuildPropertyTreesForTesting() {
bool LayerTreeHost::DoUpdateLayers(Layer* root_layer) {
TRACE_EVENT1("cc", "LayerTreeHost::DoUpdateLayers", "source_frame_number",
- source_frame_number());
+ SourceFrameNumber());
layer_tree_->UpdateHudLayer(debug_state_.ShowHudInfo());
UpdateHudLayer();
@@ -857,6 +889,10 @@ void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) {
ApplyViewportDeltas(info);
}
+const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() const {
+ return input_handler_weak_ptr_;
+}
+
void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints,
TopControlsState current,
bool animate) {
@@ -988,7 +1024,7 @@ void LayerTreeHost::OnCommitForSwapPromises() {
swap_promise->OnCommit();
}
-void LayerTreeHost::set_surface_client_id(uint32_t client_id) {
+void LayerTreeHost::SetSurfaceClientId(uint32_t client_id) {
surface_client_id_ = client_id;
}
@@ -1112,8 +1148,4 @@ void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) {
next_surface_sequence_ = proto.next_surface_sequence();
}
-AnimationHost* LayerTreeHost::animation_host() const {
- return layer_tree_->animation_host();
-}
-
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698