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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h

Issue 199443004: gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkmem: benchmark Created 6 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 | Annotate | Revision Log
OLDNEW
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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_
7 7
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" 8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/service/buffer_manager.h" 10 #include "gpu/command_buffer/service/buffer_manager.h"
11 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 11 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
12 #include "gpu/command_buffer/service/context_group.h" 12 #include "gpu/command_buffer/service/context_group.h"
13 #include "gpu/command_buffer/service/framebuffer_manager.h" 13 #include "gpu/command_buffer/service/framebuffer_manager.h"
14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
15 #include "gpu/command_buffer/service/program_manager.h" 16 #include "gpu/command_buffer/service/program_manager.h"
16 #include "gpu/command_buffer/service/query_manager.h" 17 #include "gpu/command_buffer/service/query_manager.h"
17 #include "gpu/command_buffer/service/renderbuffer_manager.h" 18 #include "gpu/command_buffer/service/renderbuffer_manager.h"
18 #include "gpu/command_buffer/service/shader_manager.h" 19 #include "gpu/command_buffer/service/shader_manager.h"
19 #include "gpu/command_buffer/service/test_helper.h" 20 #include "gpu/command_buffer/service/test_helper.h"
20 #include "gpu/command_buffer/service/texture_manager.h" 21 #include "gpu/command_buffer/service/texture_manager.h"
21 #include "gpu/command_buffer/service/vertex_array_manager.h" 22 #include "gpu/command_buffer/service/vertex_array_manager.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/gl/gl_context_stub_with_extensions.h" 24 #include "ui/gl/gl_context_stub_with_extensions.h"
24 #include "ui/gl/gl_surface_stub.h" 25 #include "ui/gl/gl_surface_stub.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 144
144 void DoCreateProgram(GLuint client_id, GLuint service_id); 145 void DoCreateProgram(GLuint client_id, GLuint service_id);
145 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); 146 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id);
146 147
147 void SetBucketAsCString(uint32 bucket_id, const char* str); 148 void SetBucketAsCString(uint32 bucket_id, const char* str);
148 149
149 void set_memory_tracker(MemoryTracker* memory_tracker) { 150 void set_memory_tracker(MemoryTracker* memory_tracker) {
150 memory_tracker_ = memory_tracker; 151 memory_tracker_ = memory_tracker;
151 } 152 }
152 153
153 void InitDecoder( 154 struct InitState {
154 const char* extensions, 155 InitState();
155 const char* gl_version,
156 bool has_alpha,
157 bool has_depth,
158 bool has_stencil,
159 bool request_alpha,
160 bool request_depth,
161 bool request_stencil,
162 bool bind_generates_resource);
163 156
164 void InitDecoderWithCommandLine( 157 std::string extensions;
165 const char* extensions, 158 std::string gl_version;
166 const char* gl_version, 159 bool has_alpha;
167 bool has_alpha, 160 bool has_depth;
168 bool has_depth, 161 bool has_stencil;
169 bool has_stencil, 162 bool request_alpha;
170 bool request_alpha, 163 bool request_depth;
171 bool request_depth, 164 bool request_stencil;
172 bool request_stencil, 165 bool bind_generates_resource;
173 bool bind_generates_resource, 166 bool lose_context_when_out_of_memory;
174 const base::CommandLine* command_line); 167 };
168
169 void InitDecoder(const InitState& init);
170 void InitDecoderWithCommandLine(const InitState& init,
171 const base::CommandLine* command_line);
175 172
176 void ResetDecoder(); 173 void ResetDecoder();
177 174
178 const ContextGroup& group() const { 175 const ContextGroup& group() const {
179 return *group_.get(); 176 return *group_.get();
180 } 177 }
181 178
182 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { 179 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const {
183 return gl_.get(); 180 return gl_.get();
184 } 181 }
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 static const GLenum kUniform3Type = GL_FLOAT_VEC3; 479 static const GLenum kUniform3Type = GL_FLOAT_VEC3;
483 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; 480 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES;
484 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; 481 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE;
485 static const GLint kInvalidUniformLocation = 30; 482 static const GLint kInvalidUniformLocation = 30;
486 static const GLint kBadUniformIndex = 1000; 483 static const GLint kBadUniformIndex = 1000;
487 484
488 // Use StrictMock to make 100% sure we know how GL will be called. 485 // Use StrictMock to make 100% sure we know how GL will be called.
489 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; 486 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
490 scoped_refptr<gfx::GLSurfaceStub> surface_; 487 scoped_refptr<gfx::GLSurfaceStub> surface_;
491 scoped_refptr<gfx::GLContextStubWithExtensions> context_; 488 scoped_refptr<gfx::GLContextStubWithExtensions> context_;
492 scoped_ptr<GLES2Decoder> mock_decoder_; 489 scoped_ptr<MockGLES2Decoder> mock_decoder_;
493 scoped_ptr<GLES2Decoder> decoder_; 490 scoped_ptr<GLES2Decoder> decoder_;
494 MemoryTracker* memory_tracker_; 491 MemoryTracker* memory_tracker_;
495 492
496 GLuint client_buffer_id_; 493 GLuint client_buffer_id_;
497 GLuint client_framebuffer_id_; 494 GLuint client_framebuffer_id_;
498 GLuint client_program_id_; 495 GLuint client_program_id_;
499 GLuint client_renderbuffer_id_; 496 GLuint client_renderbuffer_id_;
500 GLuint client_shader_id_; 497 GLuint client_shader_id_;
501 GLuint client_texture_id_; 498 GLuint client_texture_id_;
502 GLuint client_element_buffer_id_; 499 GLuint client_element_buffer_id_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 protected: 553 protected:
557 virtual void SetUp() OVERRIDE; 554 virtual void SetUp() OVERRIDE;
558 virtual void TearDown() OVERRIDE; 555 virtual void TearDown() OVERRIDE;
559 556
560 }; 557 };
561 558
562 } // namespace gles2 559 } // namespace gles2
563 } // namespace gpu 560 } // namespace gpu
564 561
565 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ 562 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698