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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // platform. At this point, it only indicates to the GpuCommandBufferStub | 134 // platform. At this point, it only indicates to the GpuCommandBufferStub |
135 // whether onscreen or offscreen rendering is requested. The window handle | 135 // whether onscreen or offscreen rendering is requested. The window handle |
136 // that will be rendered to is the child compositor window and that window | 136 // that will be rendered to is the child compositor window and that window |
137 // handle is provided by the browser process. Looking at what we are doing on | 137 // handle is provided by the browser process. Looking at what we are doing on |
138 // this and other platforms, I think a redesign is in order here. Perhaps | 138 // this and other platforms, I think a redesign is in order here. Perhaps |
139 // on all platforms the renderer just indicates whether it wants onscreen or | 139 // on all platforms the renderer just indicates whether it wants onscreen or |
140 // offscreen rendering and the browser provides whichever platform specific | 140 // offscreen rendering and the browser provides whichever platform specific |
141 // "render target" the GpuCommandBufferStub targets. | 141 // "render target" the GpuCommandBufferStub targets. |
142 handle = gfx::NativeViewFromId(view_id); | 142 handle = gfx::NativeViewFromId(view_id); |
143 #elif defined(OS_LINUX) | 143 #elif defined(OS_LINUX) |
144 ChildThread* gpu_thread = ChildThread::current(); | |
145 // Ask the browser for the view's XID. | 144 // Ask the browser for the view's XID. |
146 // TODO(piman): This assumes that it doesn't change. It can change however | 145 gpu_thread_->Send(new GpuHostMsg_GetViewXID(view_id, &handle)); |
147 // when tearing off tabs. This needs a fix in the browser UI code. A possible | |
148 // alternative would be to add a socket/plug pair like with plugins but that | |
149 // has issues with events and focus. | |
150 gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle)); | |
151 #elif defined(OS_MACOSX) | 146 #elif defined(OS_MACOSX) |
152 // On Mac OS X we currently pass a (fake) PluginWindowHandle for the | 147 // On Mac OS X we currently pass a (fake) PluginWindowHandle for the |
153 // NativeViewId. We could allocate fake NativeViewIds on the browser | 148 // NativeViewId. We could allocate fake NativeViewIds on the browser |
154 // side as well, and map between those and PluginWindowHandles, but | 149 // side as well, and map between those and PluginWindowHandles, but |
155 // this seems excessive. | 150 // this seems excessive. |
156 handle = static_cast<gfx::PluginWindowHandle>( | 151 handle = static_cast<gfx::PluginWindowHandle>( |
157 static_cast<intptr_t>(view_id)); | 152 static_cast<intptr_t>(view_id)); |
158 #else | 153 #else |
159 // TODO(apatrick): This needs to be something valid for mac and linux. | 154 // TODO(apatrick): This needs to be something valid for mac and linux. |
160 // Offscreen rendering will work on these platforms but not rendering to the | 155 // Offscreen rendering will work on these platforms but not rendering to the |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 #if defined(OS_POSIX) | 257 #if defined(OS_POSIX) |
263 int GpuChannel::GetRendererFileDescriptor() { | 258 int GpuChannel::GetRendererFileDescriptor() { |
264 int fd = -1; | 259 int fd = -1; |
265 if (channel_.get()) { | 260 if (channel_.get()) { |
266 fd = channel_->GetClientFileDescriptor(); | 261 fd = channel_->GetClientFileDescriptor(); |
267 } | 262 } |
268 return fd; | 263 return fd; |
269 } | 264 } |
270 #endif // defined(OS_POSIX) | 265 #endif // defined(OS_POSIX) |
271 | 266 |
OLD | NEW |