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

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: convert newly added scoped_ptr's Created 4 years, 8 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """code generator for GLES2 command buffers.""" 6 """code generator for GLES2 command buffers."""
7 7
8 import itertools 8 import itertools
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 6141 matching lines...) Expand 10 before | Expand all | Expand 10 after
6152 (func.name, func.GetLastOriginalArg().name)) 6152 (func.name, func.GetLastOriginalArg().name))
6153 6153
6154 def WriteImmediateHandlerImplementation(self, func, f): 6154 def WriteImmediateHandlerImplementation(self, func, f):
6155 """Overrriden from TypeHandler.""" 6155 """Overrriden from TypeHandler."""
6156 if func.IsUnsafe() and not func.UseHelper(): 6156 if func.IsUnsafe() and not func.UseHelper():
6157 f.write(""" for (GLsizei ii = 0; ii < n; ++ii) { 6157 f.write(""" for (GLsizei ii = 0; ii < n; ++ii) {
6158 if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) { 6158 if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) {
6159 return error::kInvalidArguments; 6159 return error::kInvalidArguments;
6160 } 6160 }
6161 } 6161 }
6162 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); 6162 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]);
6163 gl%(func_name)s(n, service_ids.get()); 6163 gl%(func_name)s(n, service_ids.get());
6164 for (GLsizei ii = 0; ii < n; ++ii) { 6164 for (GLsizei ii = 0; ii < n; ++ii) {
6165 group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]); 6165 group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]);
6166 } 6166 }
6167 """ % { 'func_name': func.original_name, 6167 """ % { 'func_name': func.original_name,
6168 'last_arg_name': func.GetLastOriginalArg().name, 6168 'last_arg_name': func.GetLastOriginalArg().name,
6169 'resource_name': func.GetInfo('resource_type') }) 6169 'resource_name': func.GetInfo('resource_type') })
6170 else: 6170 else:
6171 f.write(" if (!%sHelper(n, %s)) {\n" 6171 f.write(" if (!%sHelper(n, %s)) {\n"
6172 " return error::kInvalidArguments;\n" 6172 " return error::kInvalidArguments;\n"
(...skipping 4748 matching lines...) Expand 10 before | Expand all | Expand 10 after
10921 with CHeaderWriter(filename, comment) as f: 10921 with CHeaderWriter(filename, comment) as f:
10922 for func in self.original_functions: 10922 for func in self.original_functions:
10923 func.WriteGLES2InterfaceHeader(f) 10923 func.WriteGLES2InterfaceHeader(f)
10924 self.generated_cpp_filenames.append(filename) 10924 self.generated_cpp_filenames.append(filename)
10925 10925
10926 def WriteMojoGLES2ImplHeader(self, filename): 10926 def WriteMojoGLES2ImplHeader(self, filename):
10927 """Writes the Mojo GLES2 implementation header.""" 10927 """Writes the Mojo GLES2 implementation header."""
10928 comment = ("// This file is included by gles2_interface.h to declare the\n" 10928 comment = ("// This file is included by gles2_interface.h to declare the\n"
10929 "// GL api functions.\n") 10929 "// GL api functions.\n")
10930 code = """ 10930 code = """
10931 #include <memory>
10932
10931 #include "gpu/command_buffer/client/gles2_interface.h" 10933 #include "gpu/command_buffer/client/gles2_interface.h"
10932 #include "mojo/public/c/gles2/gles2.h" 10934 #include "mojo/public/c/gles2/gles2.h"
10933 10935
10934 namespace mojo { 10936 namespace mojo {
10935 10937
10936 class MojoGLES2Impl : public gpu::gles2::GLES2Interface { 10938 class MojoGLES2Impl : public gpu::gles2::GLES2Interface {
10937 public: 10939 public:
10938 explicit MojoGLES2Impl(MojoGLES2Context context) { 10940 explicit MojoGLES2Impl(MojoGLES2Context context) {
10939 context_ = context; 10941 context_ = context;
10940 } 10942 }
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
11569 Format(gen.generated_cpp_filenames) 11571 Format(gen.generated_cpp_filenames)
11570 11572
11571 if gen.errors > 0: 11573 if gen.errors > 0:
11572 print "%d errors" % gen.errors 11574 print "%d errors" % gen.errors
11573 return 1 11575 return 1
11574 return 0 11576 return 0
11575 11577
11576 11578
11577 if __name__ == '__main__': 11579 if __name__ == '__main__':
11578 sys.exit(main(sys.argv[1:])) 11580 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698