| 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 |
| 234 // The widget might have been released in the meantime. |
| 235 PerCompositorDataMap::iterator it = |
| 236 per_compositor_data_.find(compositor.get()); |
| 237 if (it == per_compositor_data_.end()) |
| 238 return; |
| 239 |
| 240 PerCompositorData* data = it->second; |
| 234 DCHECK(data); | 241 DCHECK(data); |
| 235 | 242 |
| 236 if (num_attempts > kNumRetriesBeforeSoftwareFallback) { | 243 if (num_attempts > kNumRetriesBeforeSoftwareFallback) { |
| 237 #if defined(OS_CHROMEOS) | 244 #if defined(OS_CHROMEOS) |
| 238 LOG(FATAL) << "Unable to create a UI graphics context, and cannot use " | 245 LOG(FATAL) << "Unable to create a UI graphics context, and cannot use " |
| 239 << "software compositing on ChromeOS."; | 246 << "software compositing on ChromeOS."; |
| 240 #endif | 247 #endif |
| 241 create_gpu_output_surface = false; | 248 create_gpu_output_surface = false; |
| 242 } | 249 } |
| 243 | 250 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 640 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 634 observer_list_, | 641 observer_list_, |
| 635 OnLostResources()); | 642 OnLostResources()); |
| 636 | 643 |
| 637 // Kill things that use the shared context before killing the shared context. | 644 // Kill things that use the shared context before killing the shared context. |
| 638 lost_gl_helper.reset(); | 645 lost_gl_helper.reset(); |
| 639 lost_shared_main_thread_contexts = NULL; | 646 lost_shared_main_thread_contexts = NULL; |
| 640 } | 647 } |
| 641 | 648 |
| 642 } // namespace content | 649 } // namespace content |
| OLD | NEW |