Commit f3f23433 authored by horo's avatar horo Committed by Commit bot

Revert of cc/blimp: Add a LayerTreeHostRemote implementation. (patchset #16...

Revert of cc/blimp: Add a LayerTreeHostRemote implementation. (patchset #16 id:300001 of https://codereview.chromium.org/2362073002/ )

Reason for revert:
cc_unittests on Mac-10.9 failing on chromium.mac/Mac10.9 Tests (dbg)
BUG=652502

BeginFrameArgsTest.Helpers (run #1):
[ RUN      ] BeginFrameArgsTest.Helpers
../../cc/output/begin_frame_args_unittest.cc:66: Failure
Value of: ::testing::PrintToString(args1)
  Actual: "64-byte object <B6-66 E8-02 01-00 00-00 F6-73 E8-02 01-00 00-00 16-00 00-00 A9-7F 00-00 E1-9C BD-01 01-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 FF-FF FF-FF FF-FF FF-FF 01-00 00-00 01-7F 00-00>"
Expected: std::string("BeginFrameArgs(NORMAL, 0, 0, -1us)")
Which is: "BeginFrameArgs(NORMAL, 0, 0, -1us)"
../../cc/output/begin_frame_args_unittest.cc:68: Failure
Value of: ::testing::PrintToString(args2)
  Actual: "64-byte object <B6-66 E8-02 01-00 00-00 F6-73 E8-02 01-00 00-00 1A-00 00-00 01-00 00-00 3B-9F BD-01 01-00 00-00 01-00 00-00 00-00 00-00 02-00 00-00 00-00 00-00 03-00 00-00 00-00 00-00 01-00 00-00 01-7F 00-00>"
Expected: std::string("BeginFrameArgs(NORMAL, 1, 2, 3us)")
Which is: "BeginFrameArgs(NORMAL, 1, 2, 3us)"
[  FAILED  ] BeginFrameArgsTest.Helpers (1 ms)

Original issue's description:
> cc/blimp: Add a LayerTreeHostRemote implementation.
>
> This sets up the framework for a LayerTreeHostRemote that implements
> the LayerTreeHost API when the compositor is running across a network
> boundary.
>
> This change only sets the framework for running/scheduling main frame
> updates and pushing the serialized state using the
> CompositorProtoStateSink. Subsequent patches will add state
> serialization.
>
> BUG=648442
> CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
>
> Committed: https://crrev.com/8d31bac41bbabd01f14eff89f0fc37cd9016c225
> Cr-Commit-Position: refs/heads/master@{#422555}

TBR=wez@chromium.org,dtrainor@chromium.org,danakj@chromium.org,khushalsagar@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=648442

Review-Url: https://codereview.chromium.org/2384333002
Cr-Commit-Position: refs/heads/master@{#422603}
parent 7f060555
......@@ -43,19 +43,12 @@ component("cc") {
"animation/transform_operations.cc",
"animation/transform_operations.h",
"blimp/client_picture_cache.h",
"blimp/compositor_proto_state.cc",
"blimp/compositor_proto_state.h",
"blimp/engine_picture_cache.h",
"blimp/image_serialization_processor.h",
"blimp/layer_tree_host_remote.cc",
"blimp/layer_tree_host_remote.h",
"blimp/picture_data.cc",
"blimp/picture_data.h",
"blimp/picture_data_conversions.cc",
"blimp/picture_data_conversions.h",
"blimp/remote_compositor_bridge.cc",
"blimp/remote_compositor_bridge.h",
"blimp/remote_compositor_bridge_client.h",
"debug/benchmark_instrumentation.cc",
"debug/benchmark_instrumentation.h",
"debug/debug_colors.cc",
......@@ -671,8 +664,6 @@ static_library("test_support") {
"test/fake_raster_source.h",
"test/fake_recording_source.cc",
"test/fake_recording_source.h",
"test/fake_remote_compositor_bridge.cc",
"test/fake_remote_compositor_bridge.h",
"test/fake_rendering_stats_instrumentation.h",
"test/fake_resource_provider.h",
"test/fake_scoped_ui_resource.cc",
......@@ -838,7 +829,6 @@ test("cc_unittests") {
"base/spiral_iterator_unittest.cc",
"base/tiling_data_unittest.cc",
"base/unique_notifier_unittest.cc",
"blimp/layer_tree_host_remote_unittest.cc",
"blimp/picture_data_conversions_unittest.cc",
"debug/layer_tree_debug_state_unittest.cc",
"debug/micro_benchmark_controller_unittest.cc",
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/blimp/compositor_proto_state.h"
#include "cc/output/swap_promise.h"
namespace cc {
CompositorProtoState::CompositorProtoState() = default;
CompositorProtoState::~CompositorProtoState() = default;
} // namespace cc
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_BLIMP_COMPOSITOR_PROTO_STATE_H_
#define CC_BLIMP_COMPOSITOR_PROTO_STATE_H_
#include <vector>
#include "base/macros.h"
#include "cc/base/cc_export.h"
namespace cc {
class SwapPromise;
class CC_EXPORT CompositorProtoState {
public:
CompositorProtoState();
~CompositorProtoState();
// The SwapPromises associated with this frame update.
std::vector<SwapPromise> swap_promises;
// TODO(khushalsagar): Add serialized representation of the layers, layer tree
// and display lists.
private:
DISALLOW_COPY_AND_ASSIGN(CompositorProtoState);
};
} // namespace cc
#endif // CC_BLIMP_COMPOSITOR_PROTO_STATE_H_
This diff is collapsed.
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
#define CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "cc/base/cc_export.h"
#include "cc/blimp/remote_compositor_bridge_client.h"
#include "cc/debug/layer_tree_debug_state.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_settings.h"
#include "cc/trees/surface_sequence_generator.h"
#include "cc/trees/swap_promise_manager.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace cc {
class AnimationHost;
class RemoteCompositorBridge;
class LayerTreeHostClient;
class CC_EXPORT LayerTreeHostRemote : public LayerTreeHost,
public RemoteCompositorBridgeClient {
public:
struct CC_EXPORT InitParams {
LayerTreeHostClient* client = nullptr;
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner;
std::unique_ptr<AnimationHost> animation_host;
std::unique_ptr<RemoteCompositorBridge> remote_compositor_bridge;
LayerTreeSettings const* settings = nullptr;
InitParams();
~InitParams();
};
explicit LayerTreeHostRemote(InitParams* params);
~LayerTreeHostRemote() override;
// LayerTreeHost implementation.
int GetId() const override;
int SourceFrameNumber() const override;
LayerTree* GetLayerTree() override;
const LayerTree* GetLayerTree() const override;
UIResourceManager* GetUIResourceManager() const override;
TaskRunnerProvider* GetTaskRunnerProvider() const override;
const LayerTreeSettings& GetSettings() const override;
void SetFrameSinkId(const FrameSinkId& frame_sink_id) override;
void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override;
void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override;
SwapPromiseManager* GetSwapPromiseManager() override;
void SetHasGpuRasterizationTrigger(bool has_trigger) override;
void SetVisible(bool visible) override;
bool IsVisible() const override;
void SetCompositorFrameSink(
std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override;
std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() override;
void SetNeedsAnimate() override;
void SetNeedsUpdateLayers() override;
void SetNeedsCommit() override;
bool BeginMainFrameRequested() const override;
bool CommitRequested() const override;
void SetDeferCommits(bool defer_commits) override;
void LayoutAndUpdateLayers() override;
void Composite(base::TimeTicks frame_begin_time) override;
void SetNeedsRedraw() override;
void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
void SetNextCommitForcesRedraw() override;
void NotifyInputThrottledUntilCommit() override;
void UpdateTopControlsState(TopControlsState constraints,
TopControlsState current,
bool animate) override;
const base::WeakPtr<InputHandler>& GetInputHandler() const override;
void DidStopFlinging() override;
void SetDebugState(const LayerTreeDebugState& debug_state) override;
const LayerTreeDebugState& GetDebugState() const override;
int ScheduleMicroBenchmark(
const std::string& benchmark_name,
std::unique_ptr<base::Value> value,
const MicroBenchmark::DoneCallback& callback) override;
bool SendMessageToMicroBenchmark(int id,
std::unique_ptr<base::Value> value) override;
SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override;
void SetNextCommitWaitsForActivation() override;
void ResetGpuRasterizationTracking() override;
protected:
// Protected for testing. Allows tests to inject the LayerTree.
LayerTreeHostRemote(InitParams* params,
std::unique_ptr<LayerTree> layer_tree);
private:
enum class FramePipelineStage { NONE, ANIMATE, UPDATE_LAYERS, COMMIT };
// RemoteCompositorBridgeClient implementation.
void BeginMainFrame() override;
void MainFrameRequested(FramePipelineStage requested_pipeline_stage);
void ScheduleMainFrameIfNecessary();
void MainFrameComplete();
void DispatchDrawAndSwapCallbacks();
const int id_;
int source_frame_number_ = 0;
bool visible_ = false;
bool defer_commits_ = false;
// Set to true if a main frame request is pending on the
// RemoteCompositorBridge.
bool main_frame_requested_from_bridge_ = false;
// Set to the pipeline stage we are currently at if we are inside a main frame
// update.
FramePipelineStage current_pipeline_stage_ = FramePipelineStage::NONE;
// Set to the pipeline stage we need to go to for the current main frame
// update, if we are inside a main frame update.
FramePipelineStage max_pipeline_stage_for_current_frame_ =
FramePipelineStage::NONE;
// Set to the pipeline stage requested for the next BeginMainFrame.
FramePipelineStage requested_pipeline_stage_for_next_frame_ =
FramePipelineStage::NONE;
LayerTreeHostClient* client_;
std::unique_ptr<TaskRunnerProvider> task_runner_provider_;
// The RemoteCompositorBridge used to submit frame updates to the client.
std::unique_ptr<RemoteCompositorBridge> remote_compositor_bridge_;
LayerTreeSettings settings_;
LayerTreeDebugState debug_state_;
// The LayerTree holds the root layer and other state on the engine.
std::unique_ptr<LayerTree> layer_tree_;
SwapPromiseManager swap_promise_manager_;
SurfaceSequenceGenerator surface_sequence_generator_;
base::WeakPtr<InputHandler> input_handler_weak_ptr_;
base::WeakPtrFactory<LayerTreeHostRemote> weak_factory_;
};
} // namespace cc
#endif // CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
This diff is collapsed.
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/blimp/remote_compositor_bridge.h"
#include "base/single_thread_task_runner.h"
namespace cc {
RemoteCompositorBridge::RemoteCompositorBridge(
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner)
: compositor_main_task_runner_(std::move(compositor_main_task_runner)) {}
RemoteCompositorBridge::~RemoteCompositorBridge() = default;
} // namespace cc
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_
#define CC_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "cc/base/cc_export.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace cc {
class CompositorProtoState;
class RemoteCompositorBridgeClient;
// The RemoteCompositorBridge is the remote LTH's communication bridge to the
// compositor on the client that consumes the CompositorProtoState updates and
// performs the actual compositing work. It is responsible for scheduling
// when a state update should be sent to the client and providing back
// mutations made to the state on the client.
class CC_EXPORT RemoteCompositorBridge {
public:
RemoteCompositorBridge(
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner);
virtual ~RemoteCompositorBridge();
// Must be called exactly once before the RemoteCompositorBridge can be
// used. Once bound, the client is expected to outlive this class.
virtual void BindToClient(RemoteCompositorBridgeClient* client) = 0;
// Notifies the bridge that a main frame update is required.
virtual void ScheduleMainFrame() = 0;
// If a main frame update results in any mutations to the compositor state,
// the serialized compositor state is provided to the
// RemoteCompositorBridge.
virtual void ProcessCompositorStateUpdate(
std::unique_ptr<CompositorProtoState> compositor_proto_state) = 0;
protected:
// The task runner for the compositor's main thread. The
// RemoteCompositorBridgeClient must be called on this task runner.
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner_;
private:
DISALLOW_COPY_AND_ASSIGN(RemoteCompositorBridge);
};
} // namespace cc
#endif // CC_BLIMP_REMOTE_COMPOSITOR_BRIDGE_H_
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_BLIMP_REMOTE_COMPOSITOR_BRIDGE_CLIENT_H_
#define CC_BLIMP_REMOTE_COMPOSITOR_BRIDGE_CLIENT_H_
#include "base/macros.h"
#include "cc/base/cc_export.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace cc {
class CompositorProtoState;
class CC_EXPORT RemoteCompositorBridgeClient {
public:
virtual ~RemoteCompositorBridgeClient() {}
// Called in response to a ScheduleMainFrame request made on the
// RemoteCompositorBridge.
// Note: The method should always be invoked asynchronously after the request
// is made.
virtual void BeginMainFrame() = 0;
};
} // namespace cc
#endif // CC_BLIMP_REMOTE_COMPOSITOR_BRIDGE_CLIENT_H_
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/test/fake_remote_compositor_bridge.h"
#include "base/bind.h"
#include "base/logging.h"
#include "cc/blimp/remote_compositor_bridge_client.h"
namespace cc {
FakeRemoteCompositorBridge::FakeRemoteCompositorBridge(
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner)
: RemoteCompositorBridge(std::move(compositor_main_task_runner)),
client_(nullptr),
weak_factory_(this) {}
FakeRemoteCompositorBridge::~FakeRemoteCompositorBridge() {}
void FakeRemoteCompositorBridge::BindToClient(
RemoteCompositorBridgeClient* client) {
DCHECK(!client_);
client_ = client;
}
void FakeRemoteCompositorBridge::ScheduleMainFrame() {
compositor_main_task_runner_->PostTask(
FROM_HERE, base::Bind(&FakeRemoteCompositorBridge::BeginMainFrame,
weak_factory_.GetWeakPtr()));
}
void FakeRemoteCompositorBridge::BeginMainFrame() {
client_->BeginMainFrame();
}
} // namespace cc
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_TEST_FAKE_REMOTE_COMPOSITOR_BRIDGE_H_
#define CC_TEST_FAKE_REMOTE_COMPOSITOR_BRIDGE_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "cc/blimp/compositor_proto_state.h"
#include "cc/blimp/remote_compositor_bridge.h"
namespace cc {
// An implementation of the RemoteCompositorBridge for tests that pump
// BeginMainFrames as soon as the client requests them.
class FakeRemoteCompositorBridge : public RemoteCompositorBridge {
public:
FakeRemoteCompositorBridge(
scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner);
~FakeRemoteCompositorBridge() override;
// RemoteCompositorBridge implementation.
void BindToClient(RemoteCompositorBridgeClient* client) override;
void ScheduleMainFrame() override;
void ProcessCompositorStateUpdate(
std::unique_ptr<CompositorProtoState> compositor_proto_state) override {}
private:
void BeginMainFrame();
RemoteCompositorBridgeClient* client_;
base::WeakPtrFactory<FakeRemoteCompositorBridge> weak_factory_;
};
} // namespace cc
#endif // CC_TEST_FAKE_REMOTE_COMPOSITOR_BRIDGE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment