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 #include "cc/trees/remote_channel_main.h" | |
| 6 | |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "cc/proto/compositor_message.pb.h" | |
| 9 #include "cc/proto/compositor_message_to_impl.pb.h" | |
| 10 #include "cc/proto/compositor_message_to_main.pb.h" | |
| 11 #include "cc/trees/layer_tree_host.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 scoped_ptr<RemoteChannelMain> RemoteChannelMain::Create( | |
| 16 RemoteProtoChannel* remote_proto_channel, | |
| 17 ProxyMain* proxy_main, | |
| 18 TaskRunnerProvider* task_runner_provider) { | |
| 19 return make_scoped_ptr(new RemoteChannelMain(remote_proto_channel, proxy_main, | |
| 20 task_runner_provider)); | |
| 21 } | |
| 22 | |
| 23 RemoteChannelMain::RemoteChannelMain(RemoteProtoChannel* remote_proto_channel, | |
| 24 ProxyMain* proxy_main, | |
| 25 TaskRunnerProvider* task_runner_provider) | |
| 26 : remote_proto_channel_(remote_proto_channel), | |
| 27 proxy_main_(proxy_main), | |
| 28 task_runner_provider_(task_runner_provider), | |
| 29 initialized_(false) { | |
| 30 DCHECK(remote_proto_channel_); | |
| 31 DCHECK(proxy_main_); | |
| 32 DCHECK(task_runner_provider_); | |
| 33 DCHECK(task_runner_provider_->IsMainThread()); | |
| 34 remote_proto_channel_->SetProtoReceiver(this); | |
| 35 } | |
| 36 | |
| 37 RemoteChannelMain::~RemoteChannelMain() { | |
|
David Trainor- moved to gerrit
2015/12/11 17:13:44
Same here. Add remote_proto_channel_->SetProtoRe
Khushal
2015/12/11 22:49:37
Done.
| |
| 38 DCHECK(task_runner_provider_->IsMainThread()); | |
| 39 DCHECK(!initialized_); | |
| 40 } | |
| 41 | |
| 42 void RemoteChannelMain::OnProtoReceived( | |
| 43 scoped_ptr<proto::CompositorMessage> proto) {} | |
| 44 | |
| 45 void RemoteChannelMain::SetThrottleFrameProductionOnImpl(bool throttle) {} | |
| 46 | |
| 47 void RemoteChannelMain::UpdateTopControlsStateOnImpl( | |
| 48 TopControlsState constraints, | |
| 49 TopControlsState current, | |
| 50 bool animate) {} | |
| 51 | |
| 52 void RemoteChannelMain::InitializeOutputSurfaceOnImpl( | |
| 53 OutputSurface* output_surface) {} | |
| 54 | |
| 55 void RemoteChannelMain::MainThreadHasStoppedFlingingOnImpl() { | |
| 56 proto::CompositorMessage proto; | |
| 57 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); | |
| 58 to_impl_proto->set_message_type( | |
| 59 proto::CompositorMessageToImpl::MainThreadHasStoppedFlingingOnImpl); | |
| 60 | |
| 61 SendMessageProto(proto); | |
| 62 } | |
| 63 | |
| 64 void RemoteChannelMain::SetInputThrottledUntilCommitOnImpl(bool is_throttled) {} | |
| 65 | |
| 66 void RemoteChannelMain::SetDeferCommitsOnImpl(bool defer_commits) {} | |
| 67 | |
| 68 void RemoteChannelMain::FinishAllRenderingOnImpl(CompletionEvent* completion) {} | |
|
David Trainor- moved to gerrit
2015/12/11 17:13:44
Would it be good to just signal all of these compl
Khushal
2015/12/11 22:49:37
Done.
I think it would be better to have the chan
| |
| 69 | |
| 70 void RemoteChannelMain::SetVisibleOnImpl(bool visible) {} | |
| 71 | |
| 72 void RemoteChannelMain::ReleaseOutputSurfaceOnImpl( | |
| 73 CompletionEvent* completion) {} | |
| 74 | |
| 75 void RemoteChannelMain::MainFrameWillHappenOnImplForTesting( | |
| 76 CompletionEvent* completion, | |
| 77 bool* main_frame_will_happen) { | |
| 78 // For the LayerTreeTests in remote mode, LayerTreeTest directly calls | |
| 79 // RemoteChannelImpl::MainFrameWillHappenForTesting and avoids adding a | |
| 80 // message type for tests to the compositor protocol. | |
| 81 NOTREACHED(); | |
| 82 } | |
| 83 | |
| 84 void RemoteChannelMain::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {} | |
| 85 | |
| 86 void RemoteChannelMain::SetNeedsCommitOnImpl() {} | |
| 87 | |
| 88 void RemoteChannelMain::BeginMainFrameAbortedOnImpl( | |
| 89 CommitEarlyOutReason reason, | |
| 90 base::TimeTicks main_thread_start_time) {} | |
| 91 | |
| 92 void RemoteChannelMain::StartCommitOnImpl( | |
| 93 CompletionEvent* completion, | |
| 94 LayerTreeHost* layer_tree_host, | |
| 95 base::TimeTicks main_thread_start_time, | |
| 96 bool hold_commit_for_activation) {} | |
| 97 | |
| 98 void RemoteChannelMain::SynchronouslyInitializeImpl( | |
| 99 LayerTreeHost* layer_tree_host, | |
| 100 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | |
| 101 proto::CompositorMessage proto; | |
| 102 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); | |
| 103 to_impl_proto->set_message_type( | |
| 104 proto::CompositorMessageToImpl::InitializeImpl); | |
| 105 proto::InitializeImpl* initialize_impl_proto = | |
| 106 to_impl_proto->mutable_initialize_impl_message(); | |
| 107 | |
| 108 // TODO(khushalsagar, nyquist): Add ToProtobuf and FromProtobuf methods to | |
| 109 // LayerTreeSettings for serialization. | |
| 110 proto::LayerTreeSettings* settings_proto = | |
| 111 initialize_impl_proto->mutable_layer_tree_settings(); | |
| 112 LayerTreeSettings settings = layer_tree_host->settings(); | |
| 113 settings_proto->set_single_thread_proxy_scheduler( | |
| 114 settings.single_thread_proxy_scheduler); | |
| 115 | |
| 116 SendMessageProto(proto); | |
| 117 initialized_ = true; | |
| 118 } | |
| 119 | |
| 120 void RemoteChannelMain::SynchronouslyCloseImpl() { | |
| 121 DCHECK(initialized_); | |
| 122 proto::CompositorMessage proto; | |
| 123 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); | |
| 124 to_impl_proto->set_message_type(proto::CompositorMessageToImpl::CloseImpl); | |
| 125 | |
| 126 SendMessageProto(proto); | |
| 127 initialized_ = false; | |
| 128 } | |
| 129 | |
| 130 void RemoteChannelMain::SendMessageProto( | |
| 131 const proto::CompositorMessage& proto) { | |
| 132 remote_proto_channel_->SendCompositorProto(proto); | |
| 133 } | |
| 134 | |
| 135 } // namespace cc | |
| OLD | NEW |