Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/GLStringQuery.h

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 #ifndef GLStringQuery_h 5 #ifndef GLStringQuery_h
6 #define GLStringQuery_h 6 #define GLStringQuery_h
7 7
8 #include "gpu/command_buffer/client/gles2_interface.h" 8 #include "gpu/command_buffer/client/gles2_interface.h"
9 #include "wtf/text/WTFString.h" 9 #include "wtf/text/WTFString.h"
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 }; 63 };
64 64
65 GLStringQuery(gpu::gles2::GLES2Interface* gl) : m_gl(gl) {} 65 GLStringQuery(gpu::gles2::GLES2Interface* gl) : m_gl(gl) {}
66 66
67 template <class Traits> 67 template <class Traits>
68 WTF::String Run(GLuint id) { 68 WTF::String Run(GLuint id) {
69 GLint length = 0; 69 GLint length = 0;
70 Traits::LengthFunction(m_gl, id, &length); 70 Traits::LengthFunction(m_gl, id, &length);
71 if (!length) 71 if (!length)
72 return WTF::emptyString(); 72 return WTF::emptyString;
73 LChar* logPtr; 73 LChar* logPtr;
74 RefPtr<WTF::StringImpl> nameImpl = 74 RefPtr<WTF::StringImpl> nameImpl =
75 WTF::StringImpl::createUninitialized(length, logPtr); 75 WTF::StringImpl::createUninitialized(length, logPtr);
76 GLsizei returnedLength = 0; 76 GLsizei returnedLength = 0;
77 Traits::LogFunction(m_gl, id, length, &returnedLength, logPtr); 77 Traits::LogFunction(m_gl, id, length, &returnedLength, logPtr);
78 // The returnedLength excludes the null terminator. If this check wasn't 78 // The returnedLength excludes the null terminator. If this check wasn't
79 // true, then we'd need to tell the returned String the real length. 79 // true, then we'd need to tell the returned String the real length.
80 DCHECK_EQ(returnedLength + 1, length); 80 DCHECK_EQ(returnedLength + 1, length);
81 return String(nameImpl.release()); 81 return String(nameImpl.release());
82 } 82 }
83 83
84 private: 84 private:
85 gpu::gles2::GLES2Interface* m_gl; 85 gpu::gles2::GLES2Interface* m_gl;
86 }; 86 };
87 87
88 } // namespace blink 88 } // namespace blink
89 #endif // GLStringQuery_h 89 #endif // GLStringQuery_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698