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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 gfx::PluginWindowHandle handle = gfx::kNullPluginWindow; | 126 gfx::PluginWindowHandle handle = gfx::kNullPluginWindow; |
127 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
128 gfx::NativeView view = gfx::NativeViewFromId(view_id); | 128 gfx::NativeView view = gfx::NativeViewFromId(view_id); |
129 | 129 |
130 // Check that the calling renderer is allowed to render to this window. | 130 // Check that the calling renderer is allowed to render to this window. |
131 // TODO(apatrick): consider killing the renderer process rather than failing. | 131 // TODO(apatrick): consider killing the renderer process rather than failing. |
132 int view_renderer_id = reinterpret_cast<int>( | 132 int view_renderer_id = reinterpret_cast<int>( |
133 GetProp(view, chrome::kChromiumRendererIdProperty)); | 133 GetProp(view, chrome::kChromiumRendererIdProperty)); |
134 if (view_renderer_id != renderer_id_) | 134 if (view_renderer_id != renderer_id_) |
135 return; | 135 return; |
| 136 |
| 137 // Note, we don't actually render into the view HWND. Instead, inside |
| 138 // the GpuCommandBufferStub, we will create a child window within the view |
| 139 // HWND into which we will render. |
136 handle = view; | 140 handle = view; |
137 #elif defined(OS_LINUX) | 141 #elif defined(OS_LINUX) |
138 ChildThread* gpu_thread = ChildThread::current(); | 142 ChildThread* gpu_thread = ChildThread::current(); |
139 // Ask the browser for the view's XID. | 143 // Ask the browser for the view's XID. |
140 // TODO(piman): This assumes that it doesn't change. It can change however | 144 // TODO(piman): This assumes that it doesn't change. It can change however |
141 // when tearing off tabs. This needs a fix in the browser UI code. A possible | 145 // when tearing off tabs. This needs a fix in the browser UI code. A possible |
142 // alternative would be to add a socket/plug pair like with plugins but that | 146 // alternative would be to add a socket/plug pair like with plugins but that |
143 // has issues with events and focus. | 147 // has issues with events and focus. |
144 gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle)); | 148 gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle)); |
145 #elif defined(OS_MACOSX) | 149 #elif defined(OS_MACOSX) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 channel_name, IPC::Channel::MODE_SERVER, this, NULL, | 258 channel_name, IPC::Channel::MODE_SERVER, this, NULL, |
255 ChildProcess::current()->io_message_loop(), false, | 259 ChildProcess::current()->io_message_loop(), false, |
256 ChildProcess::current()->GetShutDownEvent())); | 260 ChildProcess::current()->GetShutDownEvent())); |
257 | 261 |
258 return true; | 262 return true; |
259 } | 263 } |
260 | 264 |
261 std::string GpuChannel::GetChannelName() { | 265 std::string GpuChannel::GetChannelName() { |
262 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); | 266 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); |
263 } | 267 } |
OLD | NEW |