Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/feature/compositor/blimp_compositor_manager.h" | 5 #include "blimp/client/feature/compositor/blimp_compositor_manager.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "blimp/client/feature/compositor/blimp_layer_tree_settings.h" | 8 #include "blimp/client/feature/compositor/blimp_layer_tree_settings.h" |
| 9 #include "blimp/common/compositor/blimp_image_serialization_processor.h" | 9 #include "blimp/common/compositor/blimp_image_serialization_processor.h" |
| 10 #include "blimp/common/compositor/blimp_task_graph_runner.h" | 10 #include "blimp/common/compositor/blimp_task_graph_runner.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 } | 71 } |
| 72 | 72 |
| 73 scoped_ptr<BlimpCompositor> BlimpCompositorManager::CreateBlimpCompositor( | 73 scoped_ptr<BlimpCompositor> BlimpCompositorManager::CreateBlimpCompositor( |
| 74 int render_widget_id, BlimpCompositorClient* client) { | 74 int render_widget_id, BlimpCompositorClient* client) { |
| 75 return make_scoped_ptr( | 75 return make_scoped_ptr( |
| 76 new BlimpCompositor(render_widget_id, client)); | 76 new BlimpCompositor(render_widget_id, client)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void BlimpCompositorManager::OnRenderWidgetCreated(int render_widget_id) { | 79 void BlimpCompositorManager::OnRenderWidgetCreated(int render_widget_id) { |
| 80 DCHECK(!GetCompositor(render_widget_id)); | 80 DCHECK(!GetCompositor(render_widget_id)); |
| 81 VLOG(1) << "Creating Blimp Compositor for render widget: " | |
| 82 << render_widget_id; | |
| 81 | 83 |
| 82 compositors_[render_widget_id] = CreateBlimpCompositor(render_widget_id, | 84 compositors_[render_widget_id] = CreateBlimpCompositor(render_widget_id, |
| 83 this); | 85 this); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void BlimpCompositorManager::OnRenderWidgetInitialized(int render_widget_id) { | 88 void BlimpCompositorManager::OnRenderWidgetInitialized(int render_widget_id) { |
| 89 VLOG(1) << "Received render widget initialized message for: " | |
|
haibinlu
2016/03/30 18:37:08
redundant log given the 2 logs below?
Khushal
2016/03/30 18:55:47
Done.
| |
| 90 << render_widget_id; | |
| 87 if (active_compositor_ && | 91 if (active_compositor_ && |
| 88 active_compositor_->render_widget_id() == render_widget_id) | 92 active_compositor_->render_widget_id() == render_widget_id) |
| 89 return; | 93 return; |
| 90 | 94 |
| 91 if (active_compositor_) { | 95 if (active_compositor_) { |
| 96 VLOG(1) << "Hiding currently active compositor for render widget: " | |
| 97 << active_compositor_->render_widget_id(); | |
| 92 active_compositor_->SetVisible(false); | 98 active_compositor_->SetVisible(false); |
| 93 active_compositor_->ReleaseAcceleratedWidget(); | 99 active_compositor_->ReleaseAcceleratedWidget(); |
| 94 } | 100 } |
| 95 | 101 |
| 96 active_compositor_ = GetCompositor(render_widget_id); | 102 active_compositor_ = GetCompositor(render_widget_id); |
| 97 DCHECK(active_compositor_); | 103 DCHECK(active_compositor_); |
| 98 | 104 |
| 105 VLOG(1) << "Activating compositor for render widget: " << render_widget_id; | |
| 99 active_compositor_->SetVisible(visible_); | 106 active_compositor_->SetVisible(visible_); |
| 100 active_compositor_->SetAcceleratedWidget(window_); | 107 active_compositor_->SetAcceleratedWidget(window_); |
| 101 } | 108 } |
| 102 | 109 |
| 103 void BlimpCompositorManager::OnRenderWidgetDeleted(int render_widget_id) { | 110 void BlimpCompositorManager::OnRenderWidgetDeleted(int render_widget_id) { |
| 111 VLOG(1) << "Destroying compositor for render widget: " << render_widget_id; | |
| 104 CompositorMap::const_iterator it = compositors_.find(render_widget_id); | 112 CompositorMap::const_iterator it = compositors_.find(render_widget_id); |
| 105 DCHECK(it != compositors_.end()); | 113 DCHECK(it != compositors_.end()); |
| 106 | 114 |
| 107 // Reset the |active_compositor_| if that is what we're destroying right now. | 115 // Reset the |active_compositor_| if that is what we're destroying right now. |
| 108 if (active_compositor_ == it->second.get()) | 116 if (active_compositor_ == it->second.get()) |
| 109 active_compositor_ = nullptr; | 117 active_compositor_ = nullptr; |
| 110 | 118 |
| 111 compositors_.erase(it); | 119 compositors_.erase(it); |
| 112 } | 120 } |
| 113 | 121 |
| 114 void BlimpCompositorManager::OnCompositorMessageReceived( | 122 void BlimpCompositorManager::OnCompositorMessageReceived( |
| 115 int render_widget_id, | 123 int render_widget_id, |
| 116 scoped_ptr<cc::proto::CompositorMessage> message) { | 124 scoped_ptr<cc::proto::CompositorMessage> message) { |
| 125 VLOG(1) << "Compositor message received for render_widget: " | |
|
haibinlu
2016/03/30 18:37:08
this is already logged in net layer.
Khushal
2016/03/30 18:55:47
Does it log the render widget id as well?
haibinlu
2016/03/30 19:33:11
No, it does not. but you can add it in common/logg
Khushal
2016/03/31 18:42:04
That's neat. Done.
| |
| 126 << render_widget_id; | |
| 117 BlimpCompositor* compositor = GetCompositor(render_widget_id); | 127 BlimpCompositor* compositor = GetCompositor(render_widget_id); |
| 118 DCHECK(compositor); | 128 DCHECK(compositor); |
| 119 | 129 |
| 120 compositor->OnCompositorMessageReceived(std::move(message)); | 130 compositor->OnCompositorMessageReceived(std::move(message)); |
| 121 } | 131 } |
| 122 | 132 |
| 123 cc::LayerTreeSettings* BlimpCompositorManager::GetLayerTreeSettings() { | 133 cc::LayerTreeSettings* BlimpCompositorManager::GetLayerTreeSettings() { |
| 124 if (!settings_) { | 134 if (!settings_) { |
| 125 settings_.reset(new cc::LayerTreeSettings); | 135 settings_.reset(new cc::LayerTreeSettings); |
| 126 | 136 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 } | 179 } |
| 170 | 180 |
| 171 cc::ImageSerializationProcessor* | 181 cc::ImageSerializationProcessor* |
| 172 BlimpCompositorManager::GetImageSerializationProcessor() { | 182 BlimpCompositorManager::GetImageSerializationProcessor() { |
| 173 return image_serialization_processor_.get(); | 183 return image_serialization_processor_.get(); |
| 174 } | 184 } |
| 175 | 185 |
| 176 void BlimpCompositorManager::SendWebGestureEvent( | 186 void BlimpCompositorManager::SendWebGestureEvent( |
| 177 int render_widget_id, | 187 int render_widget_id, |
| 178 const blink::WebGestureEvent& gesture_event) { | 188 const blink::WebGestureEvent& gesture_event) { |
| 189 VLOG(1) << "Sending input event for render_widget: " << render_widget_id; | |
|
haibinlu
2016/03/30 18:37:08
ditto. logged in net layer.
| |
| 179 render_widget_feature_->SendWebGestureEvent(kDummyTabId, | 190 render_widget_feature_->SendWebGestureEvent(kDummyTabId, |
| 180 render_widget_id, | 191 render_widget_id, |
| 181 gesture_event); | 192 gesture_event); |
| 182 } | 193 } |
| 183 | 194 |
| 184 void BlimpCompositorManager::SendCompositorMessage( | 195 void BlimpCompositorManager::SendCompositorMessage( |
| 185 int render_widget_id, | 196 int render_widget_id, |
| 186 const cc::proto::CompositorMessage& message) { | 197 const cc::proto::CompositorMessage& message) { |
| 198 VLOG(1) << "Sending compositor message for render_widget: " | |
|
haibinlu
2016/03/30 18:37:08
ditto
| |
| 199 << render_widget_id; | |
| 187 render_widget_feature_->SendCompositorMessage(kDummyTabId, | 200 render_widget_feature_->SendCompositorMessage(kDummyTabId, |
| 188 render_widget_id, | 201 render_widget_id, |
| 189 message); | 202 message); |
| 190 } | 203 } |
| 191 | 204 |
| 192 BlimpCompositor* BlimpCompositorManager::GetCompositor(int render_widget_id) { | 205 BlimpCompositor* BlimpCompositorManager::GetCompositor(int render_widget_id) { |
| 193 CompositorMap::const_iterator it = compositors_.find(render_widget_id); | 206 CompositorMap::const_iterator it = compositors_.find(render_widget_id); |
| 194 if (it == compositors_.end()) | 207 if (it == compositors_.end()) |
| 195 return nullptr; | 208 return nullptr; |
| 196 return it->second.get(); | 209 return it->second.get(); |
| 197 } | 210 } |
| 198 | 211 |
| 199 } // namespace client | 212 } // namespace client |
| 200 } // namespace blimp | 213 } // namespace blimp |
| OLD | NEW |