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

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

Issue 10356114: Warm up the crypto subsystem before entering the GPU sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « no previous file | 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/rand_util.h" 13 #include "base/rand_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/threading/platform_thread.h" 15 #include "base/threading/platform_thread.h"
16 #include "base/win/scoped_com_initializer.h" 16 #include "base/win/scoped_com_initializer.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/common/gpu/gpu_config.h" 18 #include "content/common/gpu/gpu_config.h"
19 #include "content/public/common/content_client.h" 19 #include "content/public/common/content_client.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "content/public/common/main_function_params.h" 21 #include "content/public/common/main_function_params.h"
22 #include "content/gpu/gpu_child_thread.h" 22 #include "content/gpu/gpu_child_thread.h"
23 #include "content/gpu/gpu_info_collector.h" 23 #include "content/gpu/gpu_info_collector.h"
24 #include "content/gpu/gpu_process.h" 24 #include "content/gpu/gpu_process.h"
25 #include "crypto/hmac.h"
25 #include "ui/gfx/gl/gl_surface.h" 26 #include "ui/gfx/gl/gl_surface.h"
26 #include "ui/gfx/gl/gl_switches.h" 27 #include "ui/gfx/gl/gl_switches.h"
27 28
28 #if defined(OS_WIN) 29 #if defined(OS_WIN)
29 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" 30 #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
30 #include "sandbox/src/sandbox.h" 31 #include "sandbox/src/sandbox.h"
31 #endif 32 #endif
32 33
33 #if defined(USE_X11) 34 #if defined(USE_X11)
34 #include "ui/base/x/x11_util.h" 35 #include "ui/base/x/x11_util.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } else { 97 } else {
97 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed"; 98 LOG(INFO) << "gfx::GLSurface::InitializeOneOff failed";
98 gpu_info.gpu_accessible = false; 99 gpu_info.gpu_accessible = false;
99 dead_on_arrival = true; 100 dead_on_arrival = true;
100 } 101 }
101 102
102 // Warm up the random subsystem, which needs to done pre-sandbox on all 103 // Warm up the random subsystem, which needs to done pre-sandbox on all
103 // platforms. 104 // platforms.
104 (void) base::RandUint64(); 105 (void) base::RandUint64();
105 106
107 // Warm up the crypto subsystem, which needs to done pre-sandbox on all
108 // platforms.
109 crypto::HMAC hmac(crypto::HMAC::SHA256);
110 unsigned char key = '\0';
111 bool ret = hmac.Init(&key, sizeof(key));
112 (void) ret;
113
106 #if defined(OS_LINUX) 114 #if defined(OS_LINUX)
107 content::InitializeSandbox(); 115 content::InitializeSandbox();
108 #endif 116 #endif
109 117
110 base::win::ScopedCOMInitializer com_initializer; 118 base::win::ScopedCOMInitializer com_initializer;
111 119
112 #if defined(OS_WIN) 120 #if defined(OS_WIN)
113 // Preload this DLL because the sandbox prevents it from loading. 121 // Preload this DLL because the sandbox prevents it from loading.
114 LoadLibrary(L"setupapi.dll"); 122 LoadLibrary(L"setupapi.dll");
115 123
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 child_thread->Init(start_time); 157 child_thread->Init(start_time);
150 158
151 gpu_process.set_main_thread(child_thread); 159 gpu_process.set_main_thread(child_thread);
152 160
153 main_message_loop.Run(); 161 main_message_loop.Run();
154 162
155 child_thread->StopWatchdog(); 163 child_thread->StopWatchdog();
156 164
157 return 0; 165 return 0;
158 } 166 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698