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: " | |
|
haibinlu
2016/03/31 19:06:08
remove? duplicate msg with RenderWidgetLogExtracto
Khushal
2016/03/31 19:11:46
Done.
| |
| 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) { |
| 87 if (active_compositor_ && | 89 if (active_compositor_ && |
| 88 active_compositor_->render_widget_id() == render_widget_id) | 90 active_compositor_->render_widget_id() == render_widget_id) |
| 89 return; | 91 return; |
| 90 | 92 |
| 91 if (active_compositor_) { | 93 if (active_compositor_) { |
| 94 VLOG(1) << "Hiding currently active compositor for render widget: " | |
| 95 << active_compositor_->render_widget_id(); | |
| 92 active_compositor_->SetVisible(false); | 96 active_compositor_->SetVisible(false); |
| 93 active_compositor_->ReleaseAcceleratedWidget(); | 97 active_compositor_->ReleaseAcceleratedWidget(); |
| 94 } | 98 } |
| 95 | 99 |
| 96 active_compositor_ = GetCompositor(render_widget_id); | 100 active_compositor_ = GetCompositor(render_widget_id); |
| 97 DCHECK(active_compositor_); | 101 DCHECK(active_compositor_); |
| 98 | 102 |
| 103 VLOG(1) << "Activating compositor for render widget: " << render_widget_id; | |
|
haibinlu
2016/03/31 19:06:08
remove? duplicate msg with RenderWidgetLogExtracto
Khushal
2016/03/31 19:11:46
Done.
| |
| 99 active_compositor_->SetVisible(visible_); | 104 active_compositor_->SetVisible(visible_); |
| 100 active_compositor_->SetAcceleratedWidget(window_); | 105 active_compositor_->SetAcceleratedWidget(window_); |
| 101 } | 106 } |
| 102 | 107 |
| 103 void BlimpCompositorManager::OnRenderWidgetDeleted(int render_widget_id) { | 108 void BlimpCompositorManager::OnRenderWidgetDeleted(int render_widget_id) { |
| 109 VLOG(1) << "Destroying compositor for render widget: " << render_widget_id; | |
|
haibinlu
2016/03/31 19:06:08
remove? duplicate msg with RenderWidgetLogExtracto
Khushal
2016/03/31 19:11:46
Done.
| |
| 104 CompositorMap::const_iterator it = compositors_.find(render_widget_id); | 110 CompositorMap::const_iterator it = compositors_.find(render_widget_id); |
| 105 DCHECK(it != compositors_.end()); | 111 DCHECK(it != compositors_.end()); |
| 106 | 112 |
| 107 // Reset the |active_compositor_| if that is what we're destroying right now. | 113 // Reset the |active_compositor_| if that is what we're destroying right now. |
| 108 if (active_compositor_ == it->second.get()) | 114 if (active_compositor_ == it->second.get()) |
| 109 active_compositor_ = nullptr; | 115 active_compositor_ = nullptr; |
| 110 | 116 |
| 111 compositors_.erase(it); | 117 compositors_.erase(it); |
| 112 } | 118 } |
| 113 | 119 |
| 114 void BlimpCompositorManager::OnCompositorMessageReceived( | 120 void BlimpCompositorManager::OnCompositorMessageReceived( |
| 115 int render_widget_id, | 121 int render_widget_id, |
| 116 scoped_ptr<cc::proto::CompositorMessage> message) { | 122 scoped_ptr<cc::proto::CompositorMessage> message) { |
| 123 VLOG(1) << "Compositor message received for render_widget: " | |
|
haibinlu
2016/03/31 19:06:08
remove? duplicate msg with CompositorLogExtractor
Khushal
2016/03/31 19:11:46
Done.
| |
| 124 << render_widget_id; | |
| 117 BlimpCompositor* compositor = GetCompositor(render_widget_id); | 125 BlimpCompositor* compositor = GetCompositor(render_widget_id); |
| 118 DCHECK(compositor); | 126 DCHECK(compositor); |
| 119 | 127 |
| 120 compositor->OnCompositorMessageReceived(std::move(message)); | 128 compositor->OnCompositorMessageReceived(std::move(message)); |
| 121 } | 129 } |
| 122 | 130 |
| 123 cc::LayerTreeSettings* BlimpCompositorManager::GetLayerTreeSettings() { | 131 cc::LayerTreeSettings* BlimpCompositorManager::GetLayerTreeSettings() { |
| 124 if (!settings_) { | 132 if (!settings_) { |
| 125 settings_.reset(new cc::LayerTreeSettings); | 133 settings_.reset(new cc::LayerTreeSettings); |
| 126 | 134 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 | 199 |
| 192 BlimpCompositor* BlimpCompositorManager::GetCompositor(int render_widget_id) { | 200 BlimpCompositor* BlimpCompositorManager::GetCompositor(int render_widget_id) { |
| 193 CompositorMap::const_iterator it = compositors_.find(render_widget_id); | 201 CompositorMap::const_iterator it = compositors_.find(render_widget_id); |
| 194 if (it == compositors_.end()) | 202 if (it == compositors_.end()) |
| 195 return nullptr; | 203 return nullptr; |
| 196 return it->second.get(); | 204 return it->second.get(); |
| 197 } | 205 } |
| 198 | 206 |
| 199 } // namespace client | 207 } // namespace client |
| 200 } // namespace blimp | 208 } // namespace blimp |
| OLD | NEW |