| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/gpu_process_host.h" | 5 #include "chrome/browser/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/thread.h" | 8 #include "base/thread.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Global GpuProcessHost instance. | 39 // Global GpuProcessHost instance. |
| 40 // We can not use Singleton<GpuProcessHost> because that gets | 40 // We can not use Singleton<GpuProcessHost> because that gets |
| 41 // terminated on the wrong thread (main thread). We need the | 41 // terminated on the wrong thread (main thread). We need the |
| 42 // GpuProcessHost to be terminated on the same thread on which it is | 42 // GpuProcessHost to be terminated on the same thread on which it is |
| 43 // initialized, the IO thread. | 43 // initialized, the IO thread. |
| 44 static GpuProcessHost* sole_instance_ = NULL; | 44 static GpuProcessHost* sole_instance_ = NULL; |
| 45 | 45 |
| 46 } // anonymous namespace | 46 } // anonymous namespace |
| 47 | 47 |
| 48 GpuProcessHost::GpuProcessHost() | 48 GpuProcessHost::GpuProcessHost() |
| 49 : ChildProcessHost(GPU_PROCESS, NULL), | 49 : BrowserChildProcessHost(GPU_PROCESS, NULL), |
| 50 initialized_(false), | 50 initialized_(false), |
| 51 initialized_successfully_(false) { | 51 initialized_successfully_(false) { |
| 52 DCHECK_EQ(sole_instance_, static_cast<GpuProcessHost*>(NULL)); | 52 DCHECK_EQ(sole_instance_, static_cast<GpuProcessHost*>(NULL)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 GpuProcessHost::~GpuProcessHost() { | 55 GpuProcessHost::~GpuProcessHost() { |
| 56 while (!queued_synchronization_replies_.empty()) { | 56 while (!queued_synchronization_replies_.empty()) { |
| 57 delete queued_synchronization_replies_.front().reply; | 57 delete queued_synchronization_replies_.front().reply; |
| 58 queued_synchronization_replies_.pop(); | 58 queued_synchronization_replies_.pop(); |
| 59 } | 59 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 GpuProcessHost* GpuProcessHost::Get() { | 110 GpuProcessHost* GpuProcessHost::Get() { |
| 111 if (sole_instance_ == NULL) | 111 if (sole_instance_ == NULL) |
| 112 sole_instance_ = new GpuProcessHost(); | 112 sole_instance_ = new GpuProcessHost(); |
| 113 return sole_instance_; | 113 return sole_instance_; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool GpuProcessHost::Send(IPC::Message* msg) { | 116 bool GpuProcessHost::Send(IPC::Message* msg) { |
| 117 if (!EnsureInitialized()) | 117 if (!EnsureInitialized()) |
| 118 return false; | 118 return false; |
| 119 | 119 |
| 120 return ChildProcessHost::Send(msg); | 120 return BrowserChildProcessHost::Send(msg); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void GpuProcessHost::OnMessageReceived(const IPC::Message& message) { | 123 void GpuProcessHost::OnMessageReceived(const IPC::Message& message) { |
| 124 if (message.routing_id() == MSG_ROUTING_CONTROL) { | 124 if (message.routing_id() == MSG_ROUTING_CONTROL) { |
| 125 OnControlMessageReceived(message); | 125 OnControlMessageReceived(message); |
| 126 } else { | 126 } else { |
| 127 // Need to transfer this message to the UI thread and the | 127 // Need to transfer this message to the UI thread and the |
| 128 // GpuProcessHostUIShim for dispatching via its message router. | 128 // GpuProcessHostUIShim for dispatching via its message router. |
| 129 ChromeThread::PostTask(ChromeThread::UI, | 129 ChromeThread::PostTask(ChromeThread::UI, |
| 130 FROM_HERE, | 130 FROM_HERE, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 URLRequestContext* GpuProcessHost::GetRequestContext( | 217 URLRequestContext* GpuProcessHost::GetRequestContext( |
| 218 uint32 request_id, | 218 uint32 request_id, |
| 219 const ViewHostMsg_Resource_Request& request_data) { | 219 const ViewHostMsg_Resource_Request& request_data) { |
| 220 return NULL; | 220 return NULL; |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool GpuProcessHost::CanShutdown() { | 223 bool GpuProcessHost::CanShutdown() { |
| 224 return true; | 224 return true; |
| 225 } | 225 } |
| OLD | NEW |