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/gpu/gpu_channel.h" | 5 #include "chrome/gpu/gpu_channel.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 gfx::PluginWindowHandle handle = gfx::kNullPluginWindow; | 116 gfx::PluginWindowHandle handle = gfx::kNullPluginWindow; |
117 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
118 gfx::NativeView view = gfx::NativeViewFromId(view_id); | 118 gfx::NativeView view = gfx::NativeViewFromId(view_id); |
119 | 119 |
120 // Check that the calling renderer is allowed to render to this window. | 120 // Check that the calling renderer is allowed to render to this window. |
121 // TODO(apatrick): consider killing the renderer process rather than failing. | 121 // TODO(apatrick): consider killing the renderer process rather than failing. |
122 int view_renderer_id = reinterpret_cast<int>( | 122 int view_renderer_id = reinterpret_cast<int>( |
123 GetProp(view, chrome::kChromiumRendererIdProperty)); | 123 GetProp(view, chrome::kChromiumRendererIdProperty)); |
124 if (view_renderer_id != renderer_id_) | 124 if (view_renderer_id != renderer_id_) |
125 return; | 125 return; |
| 126 |
| 127 // Note, we don't actually render into the view HWND. Instead, inside |
| 128 // the GpuCommandBufferStub, we will create a child window within the view |
| 129 // HWND into which we will render. |
126 handle = view; | 130 handle = view; |
127 #elif defined(OS_LINUX) | 131 #elif defined(OS_LINUX) |
128 ChildThread* gpu_thread = ChildThread::current(); | 132 ChildThread* gpu_thread = ChildThread::current(); |
129 // Ask the browser for the view's XID. | 133 // Ask the browser for the view's XID. |
130 // TODO(piman): This assumes that it doesn't change. It can change however | 134 // TODO(piman): This assumes that it doesn't change. It can change however |
131 // when tearing off tabs. This needs a fix in the browser UI code. A possible | 135 // when tearing off tabs. This needs a fix in the browser UI code. A possible |
132 // alternative would be to add a socket/plug pair like with plugins but that | 136 // alternative would be to add a socket/plug pair like with plugins but that |
133 // has issues with events and focus. | 137 // has issues with events and focus. |
134 gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle)); | 138 gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle)); |
135 #elif defined(OS_MACOSX) | 139 #elif defined(OS_MACOSX) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 channel_name, IPC::Channel::MODE_SERVER, this, NULL, | 248 channel_name, IPC::Channel::MODE_SERVER, this, NULL, |
245 ChildProcess::current()->io_message_loop(), false, | 249 ChildProcess::current()->io_message_loop(), false, |
246 ChildProcess::current()->GetShutDownEvent())); | 250 ChildProcess::current()->GetShutDownEvent())); |
247 | 251 |
248 return true; | 252 return true; |
249 } | 253 } |
250 | 254 |
251 std::string GpuChannel::GetChannelName() { | 255 std::string GpuChannel::GetChannelName() { |
252 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); | 256 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); |
253 } | 257 } |
OLD | NEW |