Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gpu/gpu_process_host_ui_shim.h" | 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/process/kill.h" | |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "content/browser/gpu/gpu_data_manager_impl.h" | 16 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 16 #include "content/browser/gpu/gpu_process_host.h" | 17 #include "content/browser/gpu/gpu_process_host.h" |
| 17 #include "content/browser/gpu/gpu_surface_tracker.h" | 18 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 18 #include "content/browser/renderer_host/render_process_host_impl.h" | 19 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_view_host_impl.h" | 20 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 20 #include "content/common/gpu/gpu_messages.h" | 21 #include "content/common/gpu/gpu_messages.h" |
| 21 #include "content/port/browser/render_widget_host_view_port.h" | 22 #include "content/port/browser/render_widget_host_view_port.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/notification_service.h" | |
| 25 #include "content/public/browser/notification_types.h" | |
| 23 #include "ui/gl/gl_switches.h" | 26 #include "ui/gl/gl_switches.h" |
| 24 | 27 |
| 25 // From gl2/gl2ext.h. | 28 // From gl2/gl2ext.h. |
| 26 #ifndef GL_MAILBOX_SIZE_CHROMIUM | 29 #ifndef GL_MAILBOX_SIZE_CHROMIUM |
| 27 #define GL_MAILBOX_SIZE_CHROMIUM 64 | 30 #define GL_MAILBOX_SIZE_CHROMIUM 64 |
| 28 #endif | 31 #endif |
| 29 | 32 |
| 30 namespace content { | 33 namespace content { |
| 31 | 34 |
| 32 namespace { | 35 namespace { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 g_hosts_by_id.Pointer()->AddWithID(this, host_id_); | 102 g_hosts_by_id.Pointer()->AddWithID(this, host_id_); |
| 100 } | 103 } |
| 101 | 104 |
| 102 // static | 105 // static |
| 103 GpuProcessHostUIShim* GpuProcessHostUIShim::Create(int host_id) { | 106 GpuProcessHostUIShim* GpuProcessHostUIShim::Create(int host_id) { |
| 104 DCHECK(!FromID(host_id)); | 107 DCHECK(!FromID(host_id)); |
| 105 return new GpuProcessHostUIShim(host_id); | 108 return new GpuProcessHostUIShim(host_id); |
| 106 } | 109 } |
| 107 | 110 |
| 108 // static | 111 // static |
| 109 void GpuProcessHostUIShim::Destroy(int host_id, const std::string& message) { | 112 void GpuProcessHostUIShim::Destroy(int host_id, base::TerminationStatus status, |
|
Alexei Svitkine (slow)
2013/12/13 22:37:22
Nit: 1 param per line.
rkaplow
2013/12/13 23:54:03
Done.
| |
| 113 const std::string& message) { | |
| 114 // If the GPU process did not turn down normally, we send a notification. This | |
| 115 // is used to signal a gpu crash in the metrics service. | |
| 116 if (status != base::TERMINATION_STATUS_NORMAL_TERMINATION) { | |
| 117 content::NotificationService::current()->Notify( | |
| 118 content::NOTIFICATION_GPU_PROCESS_CLOSED, | |
|
Alexei Svitkine (slow)
2013/12/13 22:37:22
Nit: Indent 2 more, here and the lines below.
rkaplow
2013/12/13 23:54:03
Done.
| |
| 119 NotificationService::AllSources(), | |
| 120 NotificationService::NoDetails()); | |
| 121 } | |
| 122 | |
| 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 111 | 124 |
| 112 GpuDataManagerImpl::GetInstance()->AddLogMessage( | 125 GpuDataManagerImpl::GetInstance()->AddLogMessage( |
| 113 logging::LOG_ERROR, "GpuProcessHostUIShim", | 126 logging::LOG_ERROR, "GpuProcessHostUIShim", |
| 114 message); | 127 message); |
| 115 | 128 |
| 116 delete FromID(host_id); | 129 delete FromID(host_id); |
| 117 } | 130 } |
| 118 | 131 |
| 119 // static | 132 // static |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 view->AcceleratedSurfaceRelease(); | 379 view->AcceleratedSurfaceRelease(); |
| 367 } | 380 } |
| 368 | 381 |
| 369 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 382 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 370 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 383 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 371 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 384 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 372 video_memory_usage_stats); | 385 video_memory_usage_stats); |
| 373 } | 386 } |
| 374 | 387 |
| 375 } // namespace content | 388 } // namespace content |
| OLD | NEW |