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 <EGL/egl.h> | 5 #include <EGL/egl.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/environment.h" | 11 #include "base/environment.h" |
10 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
13 #include "gpu/command_buffer/client/gles2_lib.h" | 15 #include "gpu/command_buffer/client/gles2_lib.h" |
14 #include "gpu/command_buffer/service/gpu_switches.h" | 16 #include "gpu/command_buffer/service/gpu_switches.h" |
15 #include "gpu/config/gpu_info_collector.h" | 17 #include "gpu/config/gpu_info_collector.h" |
16 #include "gpu/config/gpu_util.h" | 18 #include "gpu/config/gpu_util.h" |
17 #include "gpu/gles2_conform_support/egl/display.h" | 19 #include "gpu/gles2_conform_support/egl/display.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); | 111 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); |
110 | 112 |
111 egl::Display* display = static_cast<egl::Display*>(dpy); | 113 egl::Display* display = static_cast<egl::Display*>(dpy); |
112 if (!display->Initialize()) | 114 if (!display->Initialize()) |
113 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); | 115 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); |
114 | 116 |
115 // eglInitialize can be called multiple times, prevent InitializeOneOff from | 117 // eglInitialize can be called multiple times, prevent InitializeOneOff from |
116 // being called multiple times. | 118 // being called multiple times. |
117 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { | 119 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { |
118 base::CommandLine::StringVector argv; | 120 base::CommandLine::StringVector argv; |
119 scoped_ptr<base::Environment> env(base::Environment::Create()); | 121 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
120 std::string env_string; | 122 std::string env_string; |
121 env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_string); | 123 env->GetVar("CHROME_COMMAND_BUFFER_GLES2_ARGS", &env_string); |
122 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
123 argv = base::SplitString(base::UTF8ToUTF16(env_string), | 125 argv = base::SplitString(base::UTF8ToUTF16(env_string), |
124 base::kWhitespaceUTF16, base::TRIM_WHITESPACE, | 126 base::kWhitespaceUTF16, base::TRIM_WHITESPACE, |
125 base::SPLIT_WANT_NONEMPTY); | 127 base::SPLIT_WANT_NONEMPTY); |
126 argv.insert(argv.begin(), base::UTF8ToUTF16("dummy")); | 128 argv.insert(argv.begin(), base::UTF8ToUTF16("dummy")); |
127 #else | 129 #else |
128 argv = base::SplitString(env_string, | 130 argv = base::SplitString(env_string, |
129 base::kWhitespaceASCII, base::TRIM_WHITESPACE, | 131 base::kWhitespaceASCII, base::TRIM_WHITESPACE, |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 return EGL_FALSE; | 470 return EGL_FALSE; |
469 } | 471 } |
470 | 472 |
471 /* Now, define eglGetProcAddress using the generic function ptr. type */ | 473 /* Now, define eglGetProcAddress using the generic function ptr. type */ |
472 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY | 474 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY |
473 eglGetProcAddress(const char* procname) { | 475 eglGetProcAddress(const char* procname) { |
474 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( | 476 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( |
475 gles2::GetGLFunctionPointer(procname)); | 477 gles2::GetGLFunctionPointer(procname)); |
476 } | 478 } |
477 } // extern "C" | 479 } // extern "C" |
OLD | NEW |