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

Side by Side Diff: cc/test/test_web_graphics_context_3d.h

Issue 46163003: Consolidate test contexts and remove unused ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ 5 #ifndef CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_
6 #define CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ 6 #define CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/containers/scoped_ptr_hash_map.h" 12 #include "base/containers/scoped_ptr_hash_map.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "cc/output/context_provider.h" 18 #include "cc/output/context_provider.h"
19 #include "cc/test/fake_web_graphics_context_3d.h" 19 #include "cc/test/fake_web_graphics_context_3d.h"
20 #include "cc/test/ordered_texture_map.h" 20 #include "cc/test/ordered_texture_map.h"
21 #include "cc/test/test_texture.h" 21 #include "cc/test/test_texture.h"
22 #include "third_party/khronos/GLES2/gl2.h" 22 #include "third_party/khronos/GLES2/gl2.h"
23 #include "ui/gfx/rect.h"
23 24
24 namespace cc { 25 namespace cc {
25 class TestContextSupport; 26 class TestContextSupport;
26 27
27 class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D { 28 class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D {
28 public: 29 public:
29 static scoped_ptr<TestWebGraphicsContext3D> Create(); 30 static scoped_ptr<TestWebGraphicsContext3D> Create();
30 31
31 virtual ~TestWebGraphicsContext3D(); 32 virtual ~TestWebGraphicsContext3D();
32 33
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 virtual void setContextLostCallback( 118 virtual void setContextLostCallback(
118 WebGraphicsContextLostCallback* callback); 119 WebGraphicsContextLostCallback* callback);
119 120
120 virtual void loseContextCHROMIUM(WebKit::WGC3Denum current, 121 virtual void loseContextCHROMIUM(WebKit::WGC3Denum current,
121 WebKit::WGC3Denum other); 122 WebKit::WGC3Denum other);
122 123
123 virtual void setSwapBuffersCompleteCallbackCHROMIUM( 124 virtual void setSwapBuffersCompleteCallbackCHROMIUM(
124 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); 125 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback);
125 126
126 virtual void prepareTexture(); 127 virtual void prepareTexture();
128 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height);
127 virtual void finish(); 129 virtual void finish();
128 virtual void flush(); 130 virtual void flush();
129 131
130 virtual void bindBuffer(WebKit::WGC3Denum target, WebKit::WebGLId buffer); 132 virtual void bindBuffer(WebKit::WGC3Denum target, WebKit::WebGLId buffer);
131 virtual void bufferData(WebKit::WGC3Denum target, 133 virtual void bufferData(WebKit::WGC3Denum target,
132 WebKit::WGC3Dsizeiptr size, 134 WebKit::WGC3Dsizeiptr size,
133 const void* data, 135 const void* data,
134 WebKit::WGC3Denum usage); 136 WebKit::WGC3Denum usage);
135 virtual void* mapBufferCHROMIUM(WebKit::WGC3Denum target, 137 virtual void* mapBufferCHROMIUM(WebKit::WGC3Denum target,
136 WebKit::WGC3Denum access); 138 WebKit::WGC3Denum access);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 virtual WebKit::WebGLId NextImageId(); 225 virtual WebKit::WebGLId NextImageId();
224 virtual void RetireImageId(WebKit::WebGLId id); 226 virtual void RetireImageId(WebKit::WebGLId id);
225 227
226 size_t GetTransferBufferMemoryUsedBytes() const; 228 size_t GetTransferBufferMemoryUsedBytes() const;
227 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); 229 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes);
228 230
229 void set_test_support(TestContextSupport* test_support) { 231 void set_test_support(TestContextSupport* test_support) {
230 test_support_ = test_support; 232 test_support_ = test_support;
231 } 233 }
232 234
235 int width() const { return width_; }
236 int height() const { return height_; }
237 bool reshape_called() const { return reshape_called_; }
238 void clear_reshape_called() { reshape_called_ = false; }
239 float scale_factor() const { return scale_factor_; }
240
241 enum UpdateType {
242 NoUpdate = 0,
243 PrepareTexture,
244 PostSubBuffer
245 };
246
247 gfx::Rect update_rect() const { return update_rect_; }
248
249 UpdateType last_update_type() {
250 return last_update_type_;
251 }
252
233 protected: 253 protected:
234 struct TextureTargets { 254 struct TextureTargets {
235 TextureTargets(); 255 TextureTargets();
236 ~TextureTargets(); 256 ~TextureTargets();
237 257
238 void BindTexture(WebKit::WGC3Denum target, WebKit::WebGLId id); 258 void BindTexture(WebKit::WGC3Denum target, WebKit::WebGLId id);
239 void UnbindTexture(WebKit::WebGLId id); 259 void UnbindTexture(WebKit::WebGLId id);
240 260
241 WebKit::WebGLId BoundTexture(WebKit::WGC3Denum target); 261 WebKit::WebGLId BoundTexture(WebKit::WGC3Denum target);
242 262
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ContextProvider::Capabilities test_capabilities_; 317 ContextProvider::Capabilities test_capabilities_;
298 int times_make_current_succeeds_; 318 int times_make_current_succeeds_;
299 int times_bind_texture_succeeds_; 319 int times_bind_texture_succeeds_;
300 int times_end_query_succeeds_; 320 int times_end_query_succeeds_;
301 int times_gen_mailbox_succeeds_; 321 int times_gen_mailbox_succeeds_;
302 bool context_lost_; 322 bool context_lost_;
303 int times_map_image_chromium_succeeds_; 323 int times_map_image_chromium_succeeds_;
304 int times_map_buffer_chromium_succeeds_; 324 int times_map_buffer_chromium_succeeds_;
305 WebGraphicsContextLostCallback* context_lost_callback_; 325 WebGraphicsContextLostCallback* context_lost_callback_;
306 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_; 326 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_;
307 base::hash_set<WebKit::WebGLId> used_textures_; 327 base::hash_set<unsigned> used_textures_;
328 unsigned next_program_id_;
329 base::hash_set<unsigned> program_set_;
330 unsigned next_shader_id_;
331 base::hash_set<unsigned> shader_set_;
308 std::vector<WebKit::WebGraphicsContext3D*> shared_contexts_; 332 std::vector<WebKit::WebGraphicsContext3D*> shared_contexts_;
309 int max_texture_size_; 333 int max_texture_size_;
334 bool reshape_called_;
310 int width_; 335 int width_;
311 int height_; 336 int height_;
337 float scale_factor_;
312 TestContextSupport* test_support_; 338 TestContextSupport* test_support_;
339 gfx::Rect update_rect_;
340 UpdateType last_update_type_;
313 341
314 unsigned bound_buffer_; 342 unsigned bound_buffer_;
315 TextureTargets texture_targets_; 343 TextureTargets texture_targets_;
316 344
317 scoped_refptr<Namespace> namespace_; 345 scoped_refptr<Namespace> namespace_;
318 static Namespace* shared_namespace_; 346 static Namespace* shared_namespace_;
319 347
320 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; 348 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_;
321 }; 349 };
322 350
323 } // namespace cc 351 } // namespace cc
324 352
325 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ 353 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_
OLDNEW
« no previous file with comments | « cc/test/fake_web_graphics_context_3d_unittest.cc ('k') | cc/test/test_web_graphics_context_3d.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698