| 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/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 else | 56 else |
| 57 delete msg; | 57 delete msg; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void StopGpuProcessOnIO(int host_id) { | 60 void StopGpuProcessOnIO(int host_id) { |
| 61 GpuProcessHost* host = GpuProcessHost::FromID(host_id); | 61 GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| 62 if (host) | 62 if (host) |
| 63 host->StopGpuProcess(); | 63 host->StopGpuProcess(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 #if defined(OS_ANDROID) |
| 67 void DestroyingVideoSurfaceOnIO(int host_id, |
| 68 int32_t surface_id, |
| 69 const base::Closure& done_cb) { |
| 70 GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| 71 if (host) |
| 72 host->DestroyingVideoSurface(surface_id, done_cb); |
| 73 else |
| 74 done_cb.Run(); |
| 75 } |
| 76 #endif |
| 77 |
| 66 } // namespace | 78 } // namespace |
| 67 | 79 |
| 68 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) { | 80 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) { |
| 69 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id); | 81 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id); |
| 70 if (ui_shim) | 82 if (ui_shim) |
| 71 ui_shim->OnMessageReceived(msg); | 83 ui_shim->OnMessageReceived(msg); |
| 72 } | 84 } |
| 73 | 85 |
| 74 GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id) | 86 GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id) |
| 75 : host_id_(host_id) { | 87 : host_id_(host_id) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 145 |
| 134 bool GpuProcessHostUIShim::Send(IPC::Message* msg) { | 146 bool GpuProcessHostUIShim::Send(IPC::Message* msg) { |
| 135 DCHECK(CalledOnValidThread()); | 147 DCHECK(CalledOnValidThread()); |
| 136 return BrowserThread::PostTask(BrowserThread::IO, | 148 return BrowserThread::PostTask(BrowserThread::IO, |
| 137 FROM_HERE, | 149 FROM_HERE, |
| 138 base::Bind(&SendOnIOThreadTask, | 150 base::Bind(&SendOnIOThreadTask, |
| 139 host_id_, | 151 host_id_, |
| 140 msg)); | 152 msg)); |
| 141 } | 153 } |
| 142 | 154 |
| 155 #if defined(OS_ANDROID) |
| 156 void GpuProcessHostUIShim::DestroyingVideoSurface( |
| 157 int surface_id, |
| 158 const base::Closure& done_cb) { |
| 159 DCHECK(CalledOnValidThread()); |
| 160 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 161 base::Bind(&DestroyingVideoSurfaceOnIO, host_id_, |
| 162 surface_id, done_cb))) { |
| 163 done_cb.Run(); |
| 164 } |
| 165 } |
| 166 #endif |
| 167 |
| 143 bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { | 168 bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { |
| 144 DCHECK(CalledOnValidThread()); | 169 DCHECK(CalledOnValidThread()); |
| 145 | 170 |
| 146 #if defined(USE_OZONE) | 171 #if defined(USE_OZONE) |
| 147 if (ui::OzonePlatform::GetInstance() | 172 if (ui::OzonePlatform::GetInstance() |
| 148 ->GetGpuPlatformSupportHost() | 173 ->GetGpuPlatformSupportHost() |
| 149 ->OnMessageReceived(message)) | 174 ->OnMessageReceived(message)) |
| 150 return true; | 175 return true; |
| 151 #endif | 176 #endif |
| 152 | 177 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 313 |
| 289 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, | 314 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, |
| 290 unsigned int target) { | 315 unsigned int target) { |
| 291 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); | 316 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); |
| 292 if (rph) { | 317 if (rph) { |
| 293 rph->OnRemoveSubscription(target); | 318 rph->OnRemoveSubscription(target); |
| 294 } | 319 } |
| 295 } | 320 } |
| 296 | 321 |
| 297 } // namespace content | 322 } // namespace content |
| OLD | NEW |