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

Side by Side Diff: content/gpu/gpu_main.cc

Issue 9401025: Collect GPU info before enabling sandbox. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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/gpu/gpu_child_thread.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdlib.h> 5 #include <stdlib.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
11 #include "base/environment.h" 11 #include "base/environment.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/threading/platform_thread.h" 14 #include "base/threading/platform_thread.h"
15 #include "base/win/scoped_com_initializer.h" 15 #include "base/win/scoped_com_initializer.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "content/common/gpu/gpu_config.h" 17 #include "content/common/gpu/gpu_config.h"
18 #include "content/public/common/content_client.h"
18 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
19 #include "content/public/common/main_function_params.h" 20 #include "content/public/common/main_function_params.h"
20 #include "content/gpu/gpu_child_thread.h" 21 #include "content/gpu/gpu_child_thread.h"
22 #include "content/gpu/gpu_info_collector.h"
21 #include "content/gpu/gpu_process.h" 23 #include "content/gpu/gpu_process.h"
22 #include "ui/gfx/gl/gl_surface.h" 24 #include "ui/gfx/gl/gl_surface.h"
23 #include "ui/gfx/gl/gl_switches.h" 25 #include "ui/gfx/gl/gl_switches.h"
24 26
25 #if defined(OS_WIN) 27 #if defined(OS_WIN)
26 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 28 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
27 #include "sandbox/src/sandbox.h" 29 #include "sandbox/src/sandbox.h"
28 #endif 30 #endif
29 31
30 #if defined(USE_X11) 32 #if defined(USE_X11)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // will need to tear down this process. However, we can not do so 66 // will need to tear down this process. However, we can not do so
65 // safely until the IPC channel is set up, because the detection of 67 // safely until the IPC channel is set up, because the detection of
66 // early return of a child process is implemented using an IPC 68 // early return of a child process is implemented using an IPC
67 // channel error. If the IPC channel is not fully set up between the 69 // channel error. If the IPC channel is not fully set up between the
68 // browser and GPU process, and the GPU process crashes or exits 70 // browser and GPU process, and the GPU process crashes or exits
69 // early, the browser process will never detect it. For this reason 71 // early, the browser process will never detect it. For this reason
70 // we defer tearing down the GPU process until receiving the 72 // we defer tearing down the GPU process until receiving the
71 // GpuMsg_Initialize message from the browser. 73 // GpuMsg_Initialize message from the browser.
72 bool dead_on_arrival = false; 74 bool dead_on_arrival = false;
73 75
74 // Load the GL implementation and locate the bindings before starting the GPU 76 // Load and initialize the GL implementation and locate the GL entry points.
75 // watchdog because this can take a lot of time and the GPU watchdog might 77 content::GPUInfo gpu_info;
76 // terminate the GPU process. 78 if (gfx::GLSurface::InitializeOneOff()) {
77 if (!gfx::GLSurface::InitializeOneOff()) { 79 // Collect information about the GPU.
80 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info)) {
81 LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo failed";
82 }
83
84 // Set the GPU info even if it failed.
85 content::GetContentClient()->SetGpuInfo(gpu_info);
86 } else {
78 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed"; 87 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed";
79 dead_on_arrival = true; 88 dead_on_arrival = true;
80 } 89 }
81 90
82 base::win::ScopedCOMInitializer com_initializer; 91 base::win::ScopedCOMInitializer com_initializer;
83 92
84 #if defined(OS_WIN) 93 #if defined(OS_WIN)
85 // Preload this DLL because the sandbox prevents it from loading. 94 // Preload this DLL because the sandbox prevents it from loading.
86 LoadLibrary(L"setupapi.dll"); 95 LoadLibrary(L"setupapi.dll");
87 96
(...skipping 19 matching lines...) Expand all
107 gfx::kGLImplementationDesktopName) { 116 gfx::kGLImplementationDesktopName) {
108 message_loop_type = MessageLoop::TYPE_UI; 117 message_loop_type = MessageLoop::TYPE_UI;
109 } 118 }
110 #endif 119 #endif
111 120
112 MessageLoop main_message_loop(message_loop_type); 121 MessageLoop main_message_loop(message_loop_type);
113 base::PlatformThread::SetName("CrGpuMain"); 122 base::PlatformThread::SetName("CrGpuMain");
114 123
115 GpuProcess gpu_process; 124 GpuProcess gpu_process;
116 125
117 GpuChildThread* child_thread = new GpuChildThread(dead_on_arrival); 126 GpuChildThread* child_thread = new GpuChildThread(dead_on_arrival, gpu_info);
118 127
119 child_thread->Init(start_time); 128 child_thread->Init(start_time);
120 129
121 gpu_process.set_main_thread(child_thread); 130 gpu_process.set_main_thread(child_thread);
122 131
123 main_message_loop.Run(); 132 main_message_loop.Run();
124 133
125 child_thread->StopWatchdog(); 134 child_thread->StopWatchdog();
126 135
127 return 0; 136 return 0;
128 } 137 }
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698