| OLD | NEW |
| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Allow the main thread or another to initialize these bindings | 84 // Allow the main thread or another to initialize these bindings |
| 85 // after instituting restrictions on I/O. Going forward they will | 85 // after instituting restrictions on I/O. Going forward they will |
| 86 // likely be used in the browser process on most platforms. The | 86 // likely be used in the browser process on most platforms. The |
| 87 // one-time initialization cost is small, between 2 and 5 ms. | 87 // one-time initialization cost is small, between 2 and 5 ms. |
| 88 base::ThreadRestrictions::ScopedAllowIO allow_io; | 88 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 89 | 89 |
| 90 switch (implementation) { | 90 switch (implementation) { |
| 91 case kGLImplementationOSMesaGL: { | 91 case kGLImplementationOSMesaGL: { |
| 92 base::FilePath module_path; | 92 base::FilePath module_path; |
| 93 if (!PathService::Get(base::DIR_MODULE, &module_path)) { | 93 PathService::Get(base::DIR_MODULE, &module_path); |
| 94 LOG(ERROR) << "PathService::Get failed."; | |
| 95 return false; | |
| 96 } | |
| 97 | |
| 98 base::NativeLibrary library = base::LoadNativeLibrary( | 94 base::NativeLibrary library = base::LoadNativeLibrary( |
| 99 module_path.Append(L"osmesa.dll"), NULL); | 95 module_path.Append(L"osmesa.dll"), NULL); |
| 100 if (!library) { | 96 if (!library) { |
| 101 DVLOG(1) << "osmesa.dll not found"; | 97 PathService::Get(base::DIR_EXE, &module_path); |
| 102 return false; | 98 library = base::LoadNativeLibrary( |
| 99 module_path.Append(L"osmesa.dll"), NULL); |
| 100 if (!library) { |
| 101 DVLOG(1) << "osmesa.dll not found"; |
| 102 return false; |
| 103 } |
| 103 } | 104 } |
| 104 | 105 |
| 105 GLGetProcAddressProc get_proc_address = | 106 GLGetProcAddressProc get_proc_address = |
| 106 reinterpret_cast<GLGetProcAddressProc>( | 107 reinterpret_cast<GLGetProcAddressProc>( |
| 107 base::GetFunctionPointerFromNativeLibrary( | 108 base::GetFunctionPointerFromNativeLibrary( |
| 108 library, "OSMesaGetProcAddress")); | 109 library, "OSMesaGetProcAddress")); |
| 109 if (!get_proc_address) { | 110 if (!get_proc_address) { |
| 110 DLOG(ERROR) << "OSMesaGetProcAddress not found."; | 111 DLOG(ERROR) << "OSMesaGetProcAddress not found."; |
| 111 base::UnloadNativeLibrary(library); | 112 base::UnloadNativeLibrary(library); |
| 112 return false; | 113 return false; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 case kGLImplementationDesktopGL: | 345 case kGLImplementationDesktopGL: |
| 345 return GetGLWindowSystemBindingInfoWGL(info); | 346 return GetGLWindowSystemBindingInfoWGL(info); |
| 346 case kGLImplementationEGLGLES2: | 347 case kGLImplementationEGLGLES2: |
| 347 return GetGLWindowSystemBindingInfoEGL(info); | 348 return GetGLWindowSystemBindingInfoEGL(info); |
| 348 default: | 349 default: |
| 349 return false; | 350 return false; |
| 350 } | 351 } |
| 351 } | 352 } |
| 352 | 353 |
| 353 } // namespace gfx | 354 } // namespace gfx |
| OLD | NEW |