| 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" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace | 98 } // namespace |
| 99 | 99 |
| 100 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) { | 100 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) { |
| 101 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id); | 101 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id); |
| 102 if (ui_shim) | 102 if (ui_shim) |
| 103 ui_shim->OnMessageReceived(msg); | 103 ui_shim->OnMessageReceived(msg); |
| 104 } | 104 } |
| 105 | 105 |
| 106 GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id) | 106 GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id, bool single_process) |
| 107 : host_id_(host_id) { | 107 : host_id_(host_id) { |
| 108 g_hosts_by_id.Pointer()->AddWithID(this, host_id_); | 108 g_hosts_by_id.Pointer()->AddWithID(this, host_id_); |
| 109 if (!single_process) |
| 110 power_monitor_broadcaster_.reset(new PowerMonitorMessageBroadcaster(this)); |
| 109 } | 111 } |
| 110 | 112 |
| 111 // static | 113 // static |
| 112 GpuProcessHostUIShim* GpuProcessHostUIShim::Create(int host_id) { | 114 GpuProcessHostUIShim* GpuProcessHostUIShim::Create(int host_id, |
| 115 bool single_process) { |
| 113 DCHECK(!FromID(host_id)); | 116 DCHECK(!FromID(host_id)); |
| 114 return new GpuProcessHostUIShim(host_id); | 117 return new GpuProcessHostUIShim(host_id, single_process); |
| 115 } | 118 } |
| 116 | 119 |
| 117 // static | 120 // static |
| 118 void GpuProcessHostUIShim::Destroy(int host_id, const std::string& message) { | 121 void GpuProcessHostUIShim::Destroy(int host_id, const std::string& message) { |
| 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 120 | 123 |
| 121 GpuDataManagerImpl::GetInstance()->AddLogMessage( | 124 GpuDataManagerImpl::GetInstance()->AddLogMessage( |
| 122 logging::LOG_ERROR, "GpuProcessHostUIShim", | 125 logging::LOG_ERROR, "GpuProcessHostUIShim", |
| 123 message); | 126 message); |
| 124 | 127 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 view->AcceleratedSurfaceRelease(); | 396 view->AcceleratedSurfaceRelease(); |
| 394 } | 397 } |
| 395 | 398 |
| 396 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 399 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 397 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 400 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 398 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 401 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 399 video_memory_usage_stats); | 402 video_memory_usage_stats); |
| 400 } | 403 } |
| 401 | 404 |
| 402 } // namespace content | 405 } // namespace content |
| OLD | NEW |