diff options
author | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-14 23:08:20 +0000 |
---|---|---|
committer | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-14 23:08:20 +0000 |
commit | 6e318e0e2b5fd1f3596f96d3cd87475b2db106a2 (patch) | |
tree | bab75e6fbfb81b9840a96691acc53934bab750b6 /ui/gfx | |
parent | da73b5f3d86e5be753151dd1951ad66cc5d668eb (diff) | |
download | chromium_src-6e318e0e2b5fd1f3596f96d3cd87475b2db106a2.zip chromium_src-6e318e0e2b5fd1f3596f96d3cd87475b2db106a2.tar.gz chromium_src-6e318e0e2b5fd1f3596f96d3cd87475b2db106a2.tar.bz2 |
Grant the GL bindings permission to do file I/O during their initialization.
This one-time initialization takes very little time and is impractical
to move to another thread when the bindings are needed.
Re-enable NoStartupWindowTest.NoStartupWindowBasicTest on Mac.
BUG=100298
TEST=NoStartupWindowTest.NoStartupWindowBasicTest
TBR=atwilson
Review URL: http://codereview.chromium.org/8301014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/gl/gl_implementation_linux.cc | 7 | ||||
-rw-r--r-- | ui/gfx/gl/gl_implementation_mac.cc | 7 | ||||
-rw-r--r-- | ui/gfx/gl/gl_implementation_win.cc | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/ui/gfx/gl/gl_implementation_linux.cc b/ui/gfx/gl/gl_implementation_linux.cc index 306f113..dea5d44 100644 --- a/ui/gfx/gl/gl_implementation_linux.cc +++ b/ui/gfx/gl/gl_implementation_linux.cc @@ -12,6 +12,7 @@ #include "base/native_library.h" #include "base/path_service.h" #include "base/synchronization/lock.h" +#include "base/threading/thread_restrictions.h" #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_implementation.h" @@ -63,6 +64,12 @@ bool InitializeGLBindings(GLImplementation implementation) { if (GetGLImplementation() != kGLImplementationNone) return true; + // Allow the main thread or another to initialize these bindings + // after instituting restrictions on I/O. Going forward they will + // likely be used in the browser process on most platforms. The + // one-time initialization cost is small, between 2 and 5 ms. + base::ThreadRestrictions::ScopedAllowIO allow_io; + switch (implementation) { #if !defined(USE_WAYLAND) case kGLImplementationOSMesaGL: { diff --git a/ui/gfx/gl/gl_implementation_mac.cc b/ui/gfx/gl/gl_implementation_mac.cc index a9537b89..780f6a7 100644 --- a/ui/gfx/gl/gl_implementation_mac.cc +++ b/ui/gfx/gl/gl_implementation_mac.cc @@ -5,6 +5,7 @@ #include "base/base_paths.h" #include "base/file_path.h" #include "base/logging.h" +#include "base/threading/thread_restrictions.h" #include "base/mac/foundation_util.h" #include "base/native_library.h" #include "base/path_service.h" @@ -24,6 +25,12 @@ bool InitializeGLBindings(GLImplementation implementation) { if (GetGLImplementation() != kGLImplementationNone) return true; + // Allow the main thread or another to initialize these bindings + // after instituting restrictions on I/O. Going forward they will + // likely be used in the browser process on most platforms. The + // one-time initialization cost is small, between 2 and 5 ms. + base::ThreadRestrictions::ScopedAllowIO allow_io; + switch (implementation) { case kGLImplementationOSMesaGL: { // osmesa.so is located in the build directory. This code path is only diff --git a/ui/gfx/gl/gl_implementation_win.cc b/ui/gfx/gl/gl_implementation_win.cc index 88d0399..de0ee31 100644 --- a/ui/gfx/gl/gl_implementation_win.cc +++ b/ui/gfx/gl/gl_implementation_win.cc @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/native_library.h" #include "base/path_service.h" +#include "base/threading/thread_restrictions.h" #include "base/stringprintf.h" #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_implementation.h" @@ -60,6 +61,12 @@ bool InitializeGLBindings(GLImplementation implementation) { if (GetGLImplementation() != kGLImplementationNone) return true; + // Allow the main thread or another to initialize these bindings + // after instituting restrictions on I/O. Going forward they will + // likely be used in the browser process on most platforms. The + // one-time initialization cost is small, between 2 and 5 ms. + base::ThreadRestrictions::ScopedAllowIO allow_io; + switch (implementation) { case kGLImplementationOSMesaGL: { FilePath module_path; |