| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 #if defined(USE_OZONE) | 128 #if defined(USE_OZONE) |
| 129 if (ui::OzonePlatform::GetInstance() | 129 if (ui::OzonePlatform::GetInstance() |
| 130 ->GetGpuPlatformSupportHost() | 130 ->GetGpuPlatformSupportHost() |
| 131 ->OnMessageReceived(message)) | 131 ->OnMessageReceived(message)) |
| 132 return true; | 132 return true; |
| 133 #endif | 133 #endif |
| 134 | 134 |
| 135 if (message.routing_id() != MSG_ROUTING_CONTROL) | 135 if (message.routing_id() != MSG_ROUTING_CONTROL) |
| 136 return false; | 136 return false; |
| 137 | 137 |
| 138 return OnControlMessageReceived(message); | 138 NOTREACHED() << "Invalid message with type = " << message.type(); |
| 139 return true; |
| 139 } | 140 } |
| 140 | 141 |
| 141 GpuProcessHostUIShim::~GpuProcessHostUIShim() { | 142 GpuProcessHostUIShim::~GpuProcessHostUIShim() { |
| 142 DCHECK(CalledOnValidThread()); | 143 DCHECK(CalledOnValidThread()); |
| 143 g_hosts_by_id.Pointer()->Remove(host_id_); | 144 g_hosts_by_id.Pointer()->Remove(host_id_); |
| 144 } | 145 } |
| 145 | 146 |
| 146 bool GpuProcessHostUIShim::OnControlMessageReceived( | |
| 147 const IPC::Message& message) { | |
| 148 DCHECK(CalledOnValidThread()); | |
| 149 | |
| 150 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) | |
| 151 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, | |
| 152 OnGraphicsInfoCollected) | |
| 153 IPC_MESSAGE_UNHANDLED_ERROR() | |
| 154 IPC_END_MESSAGE_MAP() | |
| 155 | |
| 156 return true; | |
| 157 } | |
| 158 | |
| 159 void GpuProcessHostUIShim::OnGraphicsInfoCollected( | |
| 160 const gpu::GPUInfo& gpu_info) { | |
| 161 // OnGraphicsInfoCollected is sent back after the GPU process successfully | |
| 162 // initializes GL. | |
| 163 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); | |
| 164 | |
| 165 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | |
| 166 } | |
| 167 | |
| 168 #if defined(OS_ANDROID) | 147 #if defined(OS_ANDROID) |
| 169 // static | 148 // static |
| 170 void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces( | 149 void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces( |
| 171 service_manager::InterfaceRegistry* registry) { | 150 service_manager::InterfaceRegistry* registry) { |
| 172 registry->AddInterface(base::Bind( | 151 registry->AddInterface(base::Bind( |
| 173 &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>)); | 152 &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>)); |
| 174 } | 153 } |
| 175 #endif | 154 #endif |
| 176 | 155 |
| 177 } // namespace content | 156 } // namespace content |
| OLD | NEW |