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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/browser/renderer_host/gpu_message_filter.h" | 9 #include "content/browser/renderer_host/gpu_message_filter.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 45 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
46 if (command_line->HasSwitch(switches::kUIUseGPUProcess)) { | 46 if (command_line->HasSwitch(switches::kUIUseGPUProcess)) { |
47 // When using the GPU process for UI, we need to share renderer GL contexts | 47 // When using the GPU process for UI, we need to share renderer GL contexts |
48 // with the compositor context. | 48 // with the compositor context. |
49 share_contexts_ = true; | 49 share_contexts_ = true; |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 GpuMessageFilter::~GpuMessageFilter() { | 53 GpuMessageFilter::~GpuMessageFilter() { |
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 55 GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_); |
| 56 if (host) |
| 57 host->UnregisterRenderWidgetHelper(render_process_id_); |
55 } | 58 } |
56 | 59 |
57 bool GpuMessageFilter::OnMessageReceived( | 60 bool GpuMessageFilter::OnMessageReceived( |
58 const IPC::Message& message, | 61 const IPC::Message& message, |
59 bool* message_was_ok) { | 62 bool* message_was_ok) { |
60 bool handled = true; | 63 bool handled = true; |
61 IPC_BEGIN_MESSAGE_MAP_EX(GpuMessageFilter, message, *message_was_ok) | 64 IPC_BEGIN_MESSAGE_MAP_EX(GpuMessageFilter, message, *message_was_ok) |
62 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_EstablishGpuChannel, | 65 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_EstablishGpuChannel, |
63 OnEstablishGpuChannel) | 66 OnEstablishGpuChannel) |
64 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateViewCommandBuffer, | 67 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateViewCommandBuffer, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 cause_for_gpu_launch); | 107 cause_for_gpu_launch); |
105 if (!host) { | 108 if (!host) { |
106 reply->set_reply_error(); | 109 reply->set_reply_error(); |
107 Send(reply); | 110 Send(reply); |
108 return; | 111 return; |
109 } | 112 } |
110 | 113 |
111 gpu_process_id_ = host->host_id(); | 114 gpu_process_id_ = host->host_id(); |
112 } | 115 } |
113 | 116 |
| 117 host->RegisterRenderWidgetHelper(render_process_id_, render_widget_helper_); |
| 118 |
114 host->EstablishGpuChannel( | 119 host->EstablishGpuChannel( |
115 render_process_id_, | 120 render_process_id_, |
116 share_contexts_, | 121 share_contexts_, |
117 base::Bind(&GpuMessageFilter::EstablishChannelCallback, | 122 base::Bind(&GpuMessageFilter::EstablishChannelCallback, |
118 AsWeakPtr(), | 123 AsWeakPtr(), |
119 reply)); | 124 reply)); |
120 } | 125 } |
121 | 126 |
122 void GpuMessageFilter::OnCreateViewCommandBuffer( | 127 void GpuMessageFilter::OnCreateViewCommandBuffer( |
123 int32 surface_id, | 128 int32 surface_id, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 Send(reply); | 186 Send(reply); |
182 } | 187 } |
183 | 188 |
184 void GpuMessageFilter::CreateCommandBufferCallback( | 189 void GpuMessageFilter::CreateCommandBufferCallback( |
185 IPC::Message* reply, int32 route_id) { | 190 IPC::Message* reply, int32 route_id) { |
186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
187 GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id); | 192 GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id); |
188 Send(reply); | 193 Send(reply); |
189 } | 194 } |
190 | 195 |
OLD | NEW |