| OLD | NEW |
| 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_DEBUG_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 5 #ifndef CC_DEBUG_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 6 #define CC_DEBUG_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 6 #define CC_DEBUG_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | |
| 11 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 12 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 16 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 17 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 18 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
| 19 #include "cc/base/scoped_ptr_hash_map.h" | 18 #include "cc/base/scoped_ptr_hash_map.h" |
| 20 #include "cc/debug/fake_web_graphics_context_3d.h" | 19 #include "cc/debug/fake_web_graphics_context_3d.h" |
| 21 #include "third_party/khronos/GLES2/gl2.h" | 20 #include "third_party/khronos/GLES2/gl2.h" |
| 22 | 21 |
| 23 namespace WebKit { struct WebGraphicsMemoryAllocation; } | |
| 24 | |
| 25 namespace cc { | 22 namespace cc { |
| 26 | 23 |
| 27 class CC_EXPORT TestWebGraphicsContext3D : public FakeWebGraphicsContext3D { | 24 class CC_EXPORT TestWebGraphicsContext3D : public FakeWebGraphicsContext3D { |
| 28 public: | 25 public: |
| 29 static scoped_ptr<TestWebGraphicsContext3D> Create(); | 26 static scoped_ptr<TestWebGraphicsContext3D> Create(); |
| 30 static base::Callback< | |
| 31 scoped_ptr<TestWebGraphicsContext3D>()> CreateFactory(); | |
| 32 | 27 |
| 33 virtual ~TestWebGraphicsContext3D(); | 28 virtual ~TestWebGraphicsContext3D(); |
| 34 | 29 |
| 35 virtual bool makeContextCurrent(); | 30 virtual bool makeContextCurrent(); |
| 36 | 31 |
| 37 virtual int width(); | 32 virtual int width(); |
| 38 virtual int height(); | 33 virtual int height(); |
| 39 | 34 |
| 40 virtual void reshapeWithScaleFactor( | 35 virtual void reshapeWithScaleFactor( |
| 41 int width, int height, float scale_factor); | 36 int width, int height, float scale_factor); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 107 |
| 113 // Takes ownership of the |callback|. | 108 // Takes ownership of the |callback|. |
| 114 virtual void signalSyncPoint(unsigned sync_point, | 109 virtual void signalSyncPoint(unsigned sync_point, |
| 115 WebGraphicsSyncPointCallback* callback); | 110 WebGraphicsSyncPointCallback* callback); |
| 116 virtual void signalQuery(WebKit::WebGLId query, | 111 virtual void signalQuery(WebKit::WebGLId query, |
| 117 WebGraphicsSyncPointCallback* callback); | 112 WebGraphicsSyncPointCallback* callback); |
| 118 | 113 |
| 119 virtual void setSwapBuffersCompleteCallbackCHROMIUM( | 114 virtual void setSwapBuffersCompleteCallbackCHROMIUM( |
| 120 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); | 115 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); |
| 121 | 116 |
| 122 virtual void setMemoryAllocationChangedCallbackCHROMIUM( | |
| 123 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback); | |
| 124 | |
| 125 virtual void prepareTexture(); | 117 virtual void prepareTexture(); |
| 126 virtual void finish(); | 118 virtual void finish(); |
| 127 virtual void flush(); | 119 virtual void flush(); |
| 128 | 120 |
| 129 virtual void bindBuffer(WebKit::WGC3Denum target, WebKit::WebGLId buffer); | 121 virtual void bindBuffer(WebKit::WGC3Denum target, WebKit::WebGLId buffer); |
| 130 virtual void bufferData(WebKit::WGC3Denum target, | 122 virtual void bufferData(WebKit::WGC3Denum target, |
| 131 WebKit::WGC3Dsizeiptr size, | 123 WebKit::WGC3Dsizeiptr size, |
| 132 const void* data, | 124 const void* data, |
| 133 WebKit::WGC3Denum usage); | 125 WebKit::WGC3Denum usage); |
| 134 virtual void* mapBufferCHROMIUM(WebKit::WGC3Denum target, | 126 virtual void* mapBufferCHROMIUM(WebKit::WGC3Denum target, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 192 |
| 201 void set_max_texture_size(int size) { max_texture_size_ = size; } | 193 void set_max_texture_size(int size) { max_texture_size_ = size; } |
| 202 | 194 |
| 203 static const WebKit::WebGLId kExternalTextureId; | 195 static const WebKit::WebGLId kExternalTextureId; |
| 204 virtual WebKit::WebGLId NextTextureId(); | 196 virtual WebKit::WebGLId NextTextureId(); |
| 205 | 197 |
| 206 virtual WebKit::WebGLId NextBufferId(); | 198 virtual WebKit::WebGLId NextBufferId(); |
| 207 | 199 |
| 208 virtual WebKit::WebGLId NextImageId(); | 200 virtual WebKit::WebGLId NextImageId(); |
| 209 | 201 |
| 210 void SetMemoryAllocation(WebKit::WebGraphicsMemoryAllocation allocation); | |
| 211 | |
| 212 protected: | 202 protected: |
| 213 struct Buffer { | 203 struct Buffer { |
| 214 Buffer(); | 204 Buffer(); |
| 215 ~Buffer(); | 205 ~Buffer(); |
| 216 | 206 |
| 217 WebKit::WGC3Denum target; | 207 WebKit::WGC3Denum target; |
| 218 scoped_ptr<uint8[]> pixels; | 208 scoped_ptr<uint8[]> pixels; |
| 219 | 209 |
| 220 private: | 210 private: |
| 221 DISALLOW_COPY_AND_ASSIGN(Buffer); | 211 DISALLOW_COPY_AND_ASSIGN(Buffer); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 bool have_extension_egl_image_; | 254 bool have_extension_egl_image_; |
| 265 int times_make_current_succeeds_; | 255 int times_make_current_succeeds_; |
| 266 int times_bind_texture_succeeds_; | 256 int times_bind_texture_succeeds_; |
| 267 int times_end_query_succeeds_; | 257 int times_end_query_succeeds_; |
| 268 int times_gen_mailbox_succeeds_; | 258 int times_gen_mailbox_succeeds_; |
| 269 bool context_lost_; | 259 bool context_lost_; |
| 270 int times_map_image_chromium_succeeds_; | 260 int times_map_image_chromium_succeeds_; |
| 271 int times_map_buffer_chromium_succeeds_; | 261 int times_map_buffer_chromium_succeeds_; |
| 272 WebGraphicsContextLostCallback* context_lost_callback_; | 262 WebGraphicsContextLostCallback* context_lost_callback_; |
| 273 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_; | 263 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* swap_buffers_callback_; |
| 274 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* | |
| 275 memory_allocation_changed_callback_; | |
| 276 std::vector<WebGraphicsSyncPointCallback*> sync_point_callbacks_; | 264 std::vector<WebGraphicsSyncPointCallback*> sync_point_callbacks_; |
| 277 base::hash_set<WebKit::WebGLId> used_textures_; | 265 base::hash_set<WebKit::WebGLId> used_textures_; |
| 278 std::vector<WebKit::WebGraphicsContext3D*> shared_contexts_; | 266 std::vector<WebKit::WebGraphicsContext3D*> shared_contexts_; |
| 279 int max_texture_size_; | 267 int max_texture_size_; |
| 280 int width_; | 268 int width_; |
| 281 int height_; | 269 int height_; |
| 282 | 270 |
| 283 unsigned bound_buffer_; | 271 unsigned bound_buffer_; |
| 284 | 272 |
| 285 scoped_refptr<Namespace> namespace_; | 273 scoped_refptr<Namespace> namespace_; |
| 286 static Namespace* shared_namespace_; | 274 static Namespace* shared_namespace_; |
| 287 | 275 |
| 288 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; | 276 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; |
| 289 }; | 277 }; |
| 290 | 278 |
| 291 } // namespace cc | 279 } // namespace cc |
| 292 | 280 |
| 293 #endif // CC_DEBUG_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 281 #endif // CC_DEBUG_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| OLD | NEW |