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, |
| 113 base::TerminationStatus status, | |
| 114 const std::string& message) { | |
| 115 // Send a notification if the GPU process did not turn down normally. This | |
| 116 // is used to signal a gpu crash to the metrics service. | |
| 117 if (status != base::TERMINATION_STATUS_NORMAL_TERMINATION) { | |
| 118 content::NotificationService::current()->Notify( | |
|
piman
2013/12/16 22:12:04
We're moving away from the Notification pattern, a
Ilya Sherman
2013/12/16 23:04:39
+1
| |
| 119 content::NOTIFICATION_GPU_PROCESS_CLOSED_ABNORMALLY, | |
| 120 NotificationService::AllSources(), | |
| 121 NotificationService::NoDetails()); | |
| 122 } | |
| 123 | |
| 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 111 | 125 |
| 112 GpuDataManagerImpl::GetInstance()->AddLogMessage( | 126 GpuDataManagerImpl::GetInstance()->AddLogMessage( |
| 113 logging::LOG_ERROR, "GpuProcessHostUIShim", | 127 logging::LOG_ERROR, "GpuProcessHostUIShim", |
| 114 message); | 128 message); |
| 115 | 129 |
| 116 delete FromID(host_id); | 130 delete FromID(host_id); |
| 117 } | 131 } |
| 118 | 132 |
| 119 // static | 133 // static |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 view->AcceleratedSurfaceRelease(); | 380 view->AcceleratedSurfaceRelease(); |
| 367 } | 381 } |
| 368 | 382 |
| 369 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 383 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 370 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 384 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 371 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 385 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 372 video_memory_usage_stats); | 386 video_memory_usage_stats); |
| 373 } | 387 } |
| 374 | 388 |
| 375 } // namespace content | 389 } // namespace content |
| OLD | NEW |