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/browser/gpu_process_host.h" | 5 #include "chrome/browser/gpu_process_host.h" |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
13 #include "chrome/browser/gpu_blacklist.h" | 13 #include "chrome/browser/gpu_blacklist.h" |
14 #include "chrome/browser/gpu_process_host_ui_shim.h" | 14 #include "chrome/browser/gpu_process_host_ui_shim.h" |
15 #include "chrome/browser/renderer_host/render_message_filter.h" | 15 #include "chrome/browser/renderer_host/render_message_filter.h" |
16 #include "chrome/browser/renderer_host/render_view_host.h" | 16 #include "chrome/browser/renderer_host/render_process_host.h" |
17 #include "chrome/browser/renderer_host/render_widget_host.h" | |
17 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 18 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
18 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 19 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/gpu_feature_flags.h" | 21 #include "chrome/common/gpu_feature_flags.h" |
21 #include "chrome/common/gpu_info.h" | 22 #include "chrome/common/gpu_info.h" |
22 #include "chrome/common/gpu_messages.h" | 23 #include "chrome/common/gpu_messages.h" |
23 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
24 #include "chrome/gpu/gpu_thread.h" | 25 #include "chrome/gpu/gpu_thread.h" |
25 #include "grit/browser_resources.h" | 26 #include "grit/browser_resources.h" |
26 #include "ipc/ipc_channel_handle.h" | 27 #include "ipc/ipc_channel_handle.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 } | 247 } |
247 | 248 |
248 void CVCBThreadHopping::GetViewWindow( | 249 void CVCBThreadHopping::GetViewWindow( |
249 int32 render_view_id, | 250 int32 render_view_id, |
250 int32 renderer_id, | 251 int32 renderer_id, |
251 const GPUCreateCommandBufferConfig& init_params, | 252 const GPUCreateCommandBufferConfig& init_params, |
252 IPC::Message* reply, | 253 IPC::Message* reply, |
253 scoped_refptr<RenderMessageFilter> filter) { | 254 scoped_refptr<RenderMessageFilter> filter) { |
254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
255 gfx::PluginWindowHandle window = gfx::kNullPluginWindow; | 256 gfx::PluginWindowHandle window = gfx::kNullPluginWindow; |
256 RenderViewHost* host = RenderViewHost::FromID(renderer_id, | 257 RenderProcessHost* process = RenderProcessHost::FromID(renderer_id); |
257 render_view_id); | 258 RenderWidgetHost* host = NULL; |
259 if (process) { | |
260 host = static_cast<RenderWidgetHost*>( | |
apatrick_chromium
2011/02/11 21:59:12
piman, is this cast safe if the browser does not t
piman
2011/02/11 22:07:52
I don't know, I assumed the previous code was corr
apatrick_chromium
2011/02/11 22:10:42
Perhaps the intent of the original code was to cal
| |
261 process->GetListenerByID(render_view_id)); | |
262 } | |
258 #if defined(OS_LINUX) | 263 #if defined(OS_LINUX) |
259 gfx::NativeViewId view = NULL; | 264 gfx::NativeViewId view = NULL; |
260 if (host) | 265 if (host) |
261 view = gfx::IdFromNativeView(host->view()->GetNativeView()); | 266 view = gfx::IdFromNativeView(host->view()->GetNativeView()); |
262 | 267 |
263 // Lock the window that we will draw into. | 268 // Lock the window that we will draw into. |
264 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); | 269 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); |
265 if (!manager->GetPermanentXIDForId(&window, view)) { | 270 if (!manager->GetPermanentXIDForId(&window, view)) { |
266 DLOG(ERROR) << "Can't find XID for view id " << view; | 271 DLOG(ERROR) << "Can't find XID for view id " << view; |
267 } | 272 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 520 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
516 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 521 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
517 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { | 522 blacklist->LoadGpuBlacklist(gpu_blacklist_json.as_string(), true)) { |
518 gpu_blacklist_.reset(blacklist); | 523 gpu_blacklist_.reset(blacklist); |
519 return true; | 524 return true; |
520 } | 525 } |
521 delete blacklist; | 526 delete blacklist; |
522 return false; | 527 return false; |
523 } | 528 } |
524 | 529 |
OLD | NEW |