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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 switch (implementation) { | 42 switch (implementation) { |
43 case kGLImplementationOSMesaGL: { | 43 case kGLImplementationOSMesaGL: { |
44 // osmesa.so is located in the build directory. This code path is only | 44 // osmesa.so is located in the build directory. This code path is only |
45 // valid in a developer build environment. | 45 // valid in a developer build environment. |
46 FilePath exe_path; | 46 FilePath exe_path; |
47 if (!PathService::Get(base::FILE_EXE, &exe_path)) { | 47 if (!PathService::Get(base::FILE_EXE, &exe_path)) { |
48 LOG(ERROR) << "PathService::Get failed."; | 48 LOG(ERROR) << "PathService::Get failed."; |
49 return false; | 49 return false; |
50 } | 50 } |
51 FilePath bundle_path = base::mac::GetAppBundlePath(exe_path); | 51 FilePath bundle_path = base::mac::GetAppBundlePath(exe_path); |
52 // Some unit test targets depend on osmesa but aren't build as app | |
danakj
2012/12/03 19:14:10
nit: s/build/built/
| |
53 // bundles. In that case, the .so is next to the executable. | |
54 if (bundle_path.empty()) | |
55 bundle_path = exe_path; | |
52 FilePath build_dir_path = bundle_path.DirName(); | 56 FilePath build_dir_path = bundle_path.DirName(); |
53 FilePath osmesa_path = build_dir_path.Append("osmesa.so"); | 57 FilePath osmesa_path = build_dir_path.Append("osmesa.so"); |
54 | 58 |
55 // When using OSMesa, just use OSMesaGetProcAddress to find entry points. | 59 // When using OSMesa, just use OSMesaGetProcAddress to find entry points. |
56 base::NativeLibrary library = base::LoadNativeLibrary(osmesa_path, NULL); | 60 base::NativeLibrary library = base::LoadNativeLibrary(osmesa_path, NULL); |
57 if (!library) { | 61 if (!library) { |
58 LOG(ERROR) << "osmesa.so not found at " << osmesa_path.value(); | 62 LOG(ERROR) << "osmesa.so not found at " << osmesa_path.value(); |
59 return false; | 63 return false; |
60 } | 64 } |
61 | 65 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 | 137 |
134 void ClearGLBindings() { | 138 void ClearGLBindings() { |
135 ClearGLBindingsGL(); | 139 ClearGLBindingsGL(); |
136 ClearGLBindingsOSMESA(); | 140 ClearGLBindingsOSMESA(); |
137 SetGLImplementation(kGLImplementationNone); | 141 SetGLImplementation(kGLImplementationNone); |
138 | 142 |
139 UnloadGLNativeLibraries(); | 143 UnloadGLNativeLibraries(); |
140 } | 144 } |
141 | 145 |
142 } // namespace gfx | 146 } // namespace gfx |
OLD | NEW |