| 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 "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "blimp/client/feature/compositor/blimp_layer_tree_settings.h" | 9 #include "blimp/client/feature/compositor/blimp_layer_tree_settings.h" |
| 10 #include "blimp/client/feature/compositor/client_image_serialization_processor.h
" | 10 #include "blimp/client/feature/compositor/client_image_serialization_processor.h
" |
| 11 #include "blimp/common/compositor/blimp_task_graph_runner.h" | 11 #include "blimp/common/compositor/blimp_task_graph_runner.h" |
| 12 #include "cc/proto/compositor_message.pb.h" | 12 #include "cc/proto/compositor_message.pb.h" |
| 13 | 13 |
| 14 namespace blimp { | 14 namespace blimp { |
| 15 namespace client { | 15 namespace client { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 base::LazyInstance<blimp::BlimpTaskGraphRunner> g_task_graph_runner = | 18 base::LazyInstance<blimp::BlimpTaskGraphRunner> g_task_graph_runner = |
| 19 LAZY_INSTANCE_INITIALIZER; | 19 LAZY_INSTANCE_INITIALIZER; |
| 20 | 20 |
| 21 const int kDummyTabId = 0; | 21 const int kDummyTabId = 0; |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 BlimpCompositorManager::BlimpCompositorManager( | 24 BlimpCompositorManager::BlimpCompositorManager( |
| 25 RenderWidgetFeature* render_widget_feature, | 25 RenderWidgetFeature* render_widget_feature, |
| 26 BlimpCompositorManagerClient* client) | 26 BlimpCompositorManagerClient* client) |
| 27 : visible_(false), | 27 : visible_(false), |
| 28 window_(gfx::kNullAcceleratedWidget), | 28 window_(gfx::kNullAcceleratedWidget), |
| 29 gpu_memory_buffer_manager_(new BlimpGpuMemoryBufferManager), | 29 gpu_memory_buffer_manager_(new BlimpGpuMemoryBufferManager), |
| 30 image_serialization_processor_(new ClientImageSerializationProcessor), | 30 image_serialization_processor_( |
| 31 ClientImageSerializationProcessor::GetInstance()), |
| 31 active_compositor_(nullptr), | 32 active_compositor_(nullptr), |
| 32 render_widget_feature_(render_widget_feature), | 33 render_widget_feature_(render_widget_feature), |
| 33 client_(client) { | 34 client_(client) { |
| 34 DCHECK(render_widget_feature_); | 35 DCHECK(render_widget_feature_); |
| 35 render_widget_feature_->SetDelegate(kDummyTabId, this); | 36 render_widget_feature_->SetDelegate(kDummyTabId, this); |
| 36 } | 37 } |
| 37 | 38 |
| 38 BlimpCompositorManager::~BlimpCompositorManager() { | 39 BlimpCompositorManager::~BlimpCompositorManager() { |
| 39 render_widget_feature_->RemoveDelegate(kDummyTabId); | 40 render_widget_feature_->RemoveDelegate(kDummyTabId); |
| 40 if (compositor_thread_) | 41 if (compositor_thread_) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return g_task_graph_runner.Pointer(); | 177 return g_task_graph_runner.Pointer(); |
| 177 } | 178 } |
| 178 | 179 |
| 179 gpu::GpuMemoryBufferManager* | 180 gpu::GpuMemoryBufferManager* |
| 180 BlimpCompositorManager::GetGpuMemoryBufferManager() { | 181 BlimpCompositorManager::GetGpuMemoryBufferManager() { |
| 181 return gpu_memory_buffer_manager_.get(); | 182 return gpu_memory_buffer_manager_.get(); |
| 182 } | 183 } |
| 183 | 184 |
| 184 cc::ImageSerializationProcessor* | 185 cc::ImageSerializationProcessor* |
| 185 BlimpCompositorManager::GetImageSerializationProcessor() { | 186 BlimpCompositorManager::GetImageSerializationProcessor() { |
| 186 return image_serialization_processor_.get(); | 187 return image_serialization_processor_; |
| 187 } | 188 } |
| 188 | 189 |
| 189 void BlimpCompositorManager::SendWebGestureEvent( | 190 void BlimpCompositorManager::SendWebGestureEvent( |
| 190 int render_widget_id, | 191 int render_widget_id, |
| 191 const blink::WebGestureEvent& gesture_event) { | 192 const blink::WebGestureEvent& gesture_event) { |
| 192 render_widget_feature_->SendWebGestureEvent(kDummyTabId, | 193 render_widget_feature_->SendWebGestureEvent(kDummyTabId, |
| 193 render_widget_id, | 194 render_widget_id, |
| 194 gesture_event); | 195 gesture_event); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void BlimpCompositorManager::SendCompositorMessage( | 198 void BlimpCompositorManager::SendCompositorMessage( |
| 198 int render_widget_id, | 199 int render_widget_id, |
| 199 const cc::proto::CompositorMessage& message) { | 200 const cc::proto::CompositorMessage& message) { |
| 200 render_widget_feature_->SendCompositorMessage(kDummyTabId, | 201 render_widget_feature_->SendCompositorMessage(kDummyTabId, |
| 201 render_widget_id, | 202 render_widget_id, |
| 202 message); | 203 message); |
| 203 } | 204 } |
| 204 | 205 |
| 205 BlimpCompositor* BlimpCompositorManager::GetCompositor(int render_widget_id) { | 206 BlimpCompositor* BlimpCompositorManager::GetCompositor(int render_widget_id) { |
| 206 CompositorMap::const_iterator it = compositors_.find(render_widget_id); | 207 CompositorMap::const_iterator it = compositors_.find(render_widget_id); |
| 207 if (it == compositors_.end()) | 208 if (it == compositors_.end()) |
| 208 return nullptr; | 209 return nullptr; |
| 209 return it->second.get(); | 210 return it->second.get(); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace client | 213 } // namespace client |
| 213 } // namespace blimp | 214 } // namespace blimp |
| OLD | NEW |