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