Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 EstablishedGpuChannel(compositor, create_gpu_output_surface, 0); | 223 EstablishedGpuChannel(compositor, create_gpu_output_surface, 0); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 void GpuProcessTransportFactory::EstablishedGpuChannel( | 227 void GpuProcessTransportFactory::EstablishedGpuChannel( |
| 228 base::WeakPtr<ui::Compositor> compositor, | 228 base::WeakPtr<ui::Compositor> compositor, |
| 229 bool create_gpu_output_surface, | 229 bool create_gpu_output_surface, |
| 230 int num_attempts) { | 230 int num_attempts) { |
| 231 if (!compositor) | 231 if (!compositor) |
| 232 return; | 232 return; |
| 233 PerCompositorData* data = per_compositor_data_[compositor.get()]; | 233 PerCompositorData* data = per_compositor_data_[compositor.get()]; |
|
piman
2015/10/20 01:51:49
Can you use per_compositor_data_.find(compositor.g
| |
| 234 DCHECK(data); | 234 // The widget might have been released in the meantime. |
| 235 if (!data) | |
| 236 return; | |
| 235 | 237 |
| 236 if (num_attempts > kNumRetriesBeforeSoftwareFallback) { | 238 if (num_attempts > kNumRetriesBeforeSoftwareFallback) { |
| 237 #if defined(OS_CHROMEOS) | 239 #if defined(OS_CHROMEOS) |
| 238 LOG(FATAL) << "Unable to create a UI graphics context, and cannot use " | 240 LOG(FATAL) << "Unable to create a UI graphics context, and cannot use " |
| 239 << "software compositing on ChromeOS."; | 241 << "software compositing on ChromeOS."; |
| 240 #endif | 242 #endif |
| 241 create_gpu_output_surface = false; | 243 create_gpu_output_surface = false; |
| 242 } | 244 } |
| 243 | 245 |
| 244 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 246 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 635 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 634 observer_list_, | 636 observer_list_, |
| 635 OnLostResources()); | 637 OnLostResources()); |
| 636 | 638 |
| 637 // Kill things that use the shared context before killing the shared context. | 639 // Kill things that use the shared context before killing the shared context. |
| 638 lost_gl_helper.reset(); | 640 lost_gl_helper.reset(); |
| 639 lost_shared_main_thread_contexts = NULL; | 641 lost_shared_main_thread_contexts = NULL; |
| 640 } | 642 } |
| 641 | 643 |
| 642 } // namespace content | 644 } // namespace content |
| OLD | NEW |