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

Side by Side Diff: content/common/sandbox_mac.mm

Issue 8233027: Support dynamic switching between integrated and discrete GPUs on Mac OS X. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/common/gpu/gpu_messages.h ('k') | content/gpu/gpu_info_collector.cc » ('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/common/sandbox_mac.h" 5 #include "content/common/sandbox_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <OpenGL/OpenGL.h>
9 8
10 extern "C" { 9 extern "C" {
11 #include <sandbox.h> 10 #include <sandbox.h>
12 } 11 }
13 #include <signal.h> 12 #include <signal.h>
14 #include <sys/param.h> 13 #include <sys/param.h>
15 14
16 #include "base/basictypes.h" 15 #include "base/basictypes.h"
17 #include "base/command_line.h" 16 #include "base/command_line.h"
18 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 242 }
244 243
245 { 244 {
246 // Allow access to /dev/urandom. 245 // Allow access to /dev/urandom.
247 GetUrandomFD(); 246 GetUrandomFD();
248 } 247 }
249 248
250 // Process-type dependent warm-up. 249 // Process-type dependent warm-up.
251 switch (sandbox_type) { 250 switch (sandbox_type) {
252 case SANDBOX_TYPE_GPU: 251 case SANDBOX_TYPE_GPU:
253 { // GPU-related stuff is very slow without this, probably because
254 // the sandbox prevents loading graphics drivers or some such.
255 CGLPixelFormatAttribute attribs[] = { (CGLPixelFormatAttribute)0 };
256 CGLPixelFormatObj format;
257 GLint n;
258 CGLChoosePixelFormat(attribs, &format, &n);
259 if (format)
260 CGLReleasePixelFormat(format);
261 }
262
263 { 252 {
264 // Preload either the desktop GL or the osmesa so, depending on the 253 // Preload either the desktop GL or the osmesa so, depending on the
265 // --use-gl flag. 254 // --use-gl flag.
266 gfx::GLSurface::InitializeOneOff(); 255 gfx::GLSurface::InitializeOneOff();
267 } 256 }
268 break; 257 break;
269 258
270 default: 259 default:
271 // To shut up a gcc warning. 260 // To shut up a gcc warning.
272 break; 261 break;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { 570 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) {
582 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " 571 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: "
583 << path->value(); 572 << path->value();
584 return; 573 return;
585 } 574 }
586 575
587 *path = FilePath(canonical_path); 576 *path = FilePath(canonical_path);
588 } 577 }
589 578
590 } // namespace sandbox 579 } // namespace sandbox
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/gpu/gpu_info_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698