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