Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 7006006: Replace OS_LINUX ifdefs with OS_POSIX & !OS_MACOSX, TOOLKIT_USES_GTK, or (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/browser/plugin_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/gpu/gpu_process_host_ui_shim.h" 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
6 6
7 #include "base/id_map.h" 7 #include "base/id_map.h"
8 #include "base/process_util.h" 8 #include "base/process_util.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "content/browser/browser_thread.h" 10 #include "content/browser/browser_thread.h"
11 #include "content/browser/gpu/gpu_data_manager.h" 11 #include "content/browser/gpu/gpu_data_manager.h"
12 #include "content/browser/gpu/gpu_process_host.h" 12 #include "content/browser/gpu/gpu_process_host.h"
13 #include "content/browser/renderer_host/render_process_host.h" 13 #include "content/browser/renderer_host/render_process_host.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/renderer_host/render_widget_host_view.h" 15 #include "content/browser/renderer_host/render_widget_host_view.h"
16 #include "content/common/gpu/gpu_messages.h" 16 #include "content/common/gpu/gpu_messages.h"
17 17
18 #if defined(OS_LINUX) 18 #if defined(TOOLKIT_USES_GTK)
19 // These two #includes need to come after gpu_messages.h. 19 // These two #includes need to come after gpu_messages.h.
20 #include <gdk/gdkwindow.h> // NOLINT 20 #include <gdk/gdkwindow.h> // NOLINT
21 #include <gdk/gdkx.h> // NOLINT 21 #include <gdk/gdkx.h> // NOLINT
22 #include "ui/base/x/x11_util.h" 22 #include "ui/base/x/x11_util.h"
23 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
24 #endif // defined(OS_LINUX) 24 #endif
25 namespace { 25 namespace {
26 26
27 // One of the linux specific headers defines this as a macro. 27 // One of the linux specific headers defines this as a macro.
28 #ifdef DestroyAll 28 #ifdef DestroyAll
29 #undef DestroyAll 29 #undef DestroyAll
30 #endif 30 #endif
31 31
32 IDMap<GpuProcessHostUIShim> g_hosts_by_id; 32 IDMap<GpuProcessHostUIShim> g_hosts_by_id;
33 33
34 class SendOnIOThreadTask : public Task { 34 class SendOnIOThreadTask : public Task {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 g_hosts_by_id.Remove(host_id_); 138 g_hosts_by_id.Remove(host_id_);
139 } 139 }
140 140
141 bool GpuProcessHostUIShim::OnControlMessageReceived( 141 bool GpuProcessHostUIShim::OnControlMessageReceived(
142 const IPC::Message& message) { 142 const IPC::Message& message) {
143 DCHECK(CalledOnValidThread()); 143 DCHECK(CalledOnValidThread());
144 144
145 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 145 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
146 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, 146 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
147 OnLogMessage) 147 OnLogMessage)
148 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN) 148 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
149 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) 149 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
150 #elif defined(OS_MACOSX) 150 #elif defined(OS_MACOSX)
151 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface, 151 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
152 OnAcceleratedSurfaceSetIOSurface) 152 OnAcceleratedSurfaceSetIOSurface)
153 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 153 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
154 OnAcceleratedSurfaceBuffersSwapped) 154 OnAcceleratedSurfaceBuffersSwapped)
155 #endif 155 #endif
156 IPC_MESSAGE_UNHANDLED_ERROR() 156 IPC_MESSAGE_UNHANDLED_ERROR()
157 IPC_END_MESSAGE_MAP() 157 IPC_END_MESSAGE_MAP()
158 158
159 return true; 159 return true;
160 } 160 }
161 161
162 void GpuProcessHostUIShim::OnLogMessage( 162 void GpuProcessHostUIShim::OnLogMessage(
163 int level, 163 int level,
164 const std::string& header, 164 const std::string& header,
165 const std::string& message) { 165 const std::string& message) {
166 DictionaryValue* dict = new DictionaryValue(); 166 DictionaryValue* dict = new DictionaryValue();
167 dict->SetInteger("level", level); 167 dict->SetInteger("level", level);
168 dict->SetString("header", header); 168 dict->SetString("header", header);
169 dict->SetString("message", message); 169 dict->SetString("message", message);
170 GpuDataManager::GetInstance()->AddLogMessage(dict); 170 GpuDataManager::GetInstance()->AddLogMessage(dict);
171 } 171 }
172 172
173 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN) 173 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
174 174
175 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, 175 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id,
176 int32 render_view_id, 176 int32 render_view_id,
177 int32 command_buffer_route_id, 177 int32 command_buffer_route_id,
178 gfx::Size size) { 178 gfx::Size size) {
179 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id); 179 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id);
180 if (host) { 180 if (host) {
181 RenderWidgetHostView* view = host->view(); 181 RenderWidgetHostView* view = host->view();
182 if (view) { 182 if (view) {
183 gfx::PluginWindowHandle handle = view->GetCompositingSurface(); 183 gfx::PluginWindowHandle handle = view->GetCompositingSurface();
184 184
185 // Resize the window synchronously. The GPU process must not issue GL 185 // Resize the window synchronously. The GPU process must not issue GL
186 // calls on the command buffer until the window is the size it expects it 186 // calls on the command buffer until the window is the size it expects it
187 // to be. 187 // to be.
188 #if defined(OS_LINUX) && !defined(TOUCH_UI) 188 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI)
189 GdkWindow* window = reinterpret_cast<GdkWindow*>( 189 GdkWindow* window = reinterpret_cast<GdkWindow*>(
190 gdk_xid_table_lookup(handle)); 190 gdk_xid_table_lookup(handle));
191 if (window) { 191 if (window) {
192 Display* display = GDK_WINDOW_XDISPLAY(window); 192 Display* display = GDK_WINDOW_XDISPLAY(window);
193 gdk_window_resize(window, size.width(), size.height()); 193 gdk_window_resize(window, size.width(), size.height());
194 XSync(display, False); 194 XSync(display, False);
195 } 195 }
196 #elif defined(OS_WIN) 196 #elif defined(OS_WIN)
197 SetWindowPos(handle, 197 SetWindowPos(handle,
198 NULL, 198 NULL,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 params.window, 244 params.window,
245 params.surface_id, 245 params.surface_id,
246 // Parameters needed to formulate an acknowledgment. 246 // Parameters needed to formulate an acknowledgment.
247 params.renderer_id, 247 params.renderer_id,
248 params.route_id, 248 params.route_id,
249 host_id_, 249 host_id_,
250 params.swap_buffers_count); 250 params.swap_buffers_count);
251 } 251 }
252 252
253 #endif 253 #endif
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/browser/plugin_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698