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

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

Issue 1587283002: Switch cc to std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unordered-map
Patch Set: Fix MSVC build issue Created 4 years, 11 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
« no previous file with comments | « cc/test/test_texture.h ('k') | cc/test/test_web_graphics_context_3d.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <unordered_map>
12 #include <unordered_set>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/callback.h" 15 #include "base/callback.h"
14 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
15 #include "base/containers/hash_tables.h"
16 #include "base/containers/scoped_ptr_hash_map.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
23 #include "cc/output/context_provider.h" 23 #include "cc/output/context_provider.h"
24 #include "cc/test/ordered_texture_map.h" 24 #include "cc/test/ordered_texture_map.h"
25 #include "cc/test/test_texture.h" 25 #include "cc/test/test_texture.h"
26 #include "gpu/command_buffer/common/sync_token.h" 26 #include "gpu/command_buffer/common/sync_token.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 struct TextureTargets { 397 struct TextureTargets {
398 TextureTargets(); 398 TextureTargets();
399 ~TextureTargets(); 399 ~TextureTargets();
400 400
401 void BindTexture(GLenum target, GLuint id); 401 void BindTexture(GLenum target, GLuint id);
402 void UnbindTexture(GLuint id); 402 void UnbindTexture(GLuint id);
403 403
404 GLuint BoundTexture(GLenum target); 404 GLuint BoundTexture(GLenum target);
405 405
406 private: 406 private:
407 typedef base::hash_map<GLenum, GLuint> TargetTextureMap; 407 using TargetTextureMap = std::unordered_map<GLenum, GLuint>;
408 TargetTextureMap bound_textures_; 408 TargetTextureMap bound_textures_;
409 }; 409 };
410 410
411 struct Buffer { 411 struct Buffer {
412 Buffer(); 412 Buffer();
413 ~Buffer(); 413 ~Buffer();
414 414
415 GLenum target; 415 GLenum target;
416 scoped_ptr<uint8_t[]> pixels; 416 scoped_ptr<uint8_t[]> pixels;
417 size_t size; 417 size_t size;
(...skipping 14 matching lines...) Expand all
432 432
433 struct Namespace : public base::RefCountedThreadSafe<Namespace> { 433 struct Namespace : public base::RefCountedThreadSafe<Namespace> {
434 Namespace(); 434 Namespace();
435 435
436 // Protects all fields. 436 // Protects all fields.
437 base::Lock lock; 437 base::Lock lock;
438 unsigned next_buffer_id; 438 unsigned next_buffer_id;
439 unsigned next_image_id; 439 unsigned next_image_id;
440 unsigned next_texture_id; 440 unsigned next_texture_id;
441 unsigned next_renderbuffer_id; 441 unsigned next_renderbuffer_id;
442 base::ScopedPtrHashMap<unsigned, scoped_ptr<Buffer>> buffers; 442 std::unordered_map<unsigned, scoped_ptr<Buffer>> buffers;
443 base::hash_set<unsigned> images; 443 std::unordered_set<unsigned> images;
444 OrderedTextureMap textures; 444 OrderedTextureMap textures;
445 base::hash_set<unsigned> renderbuffer_set; 445 std::unordered_set<unsigned> renderbuffer_set;
446 446
447 private: 447 private:
448 friend class base::RefCountedThreadSafe<Namespace>; 448 friend class base::RefCountedThreadSafe<Namespace>;
449 ~Namespace(); 449 ~Namespace();
450 DISALLOW_COPY_AND_ASSIGN(Namespace); 450 DISALLOW_COPY_AND_ASSIGN(Namespace);
451 }; 451 };
452 452
453 TestWebGraphicsContext3D(); 453 TestWebGraphicsContext3D();
454 454
455 void CreateNamespace(); 455 void CreateNamespace();
456 GLuint BoundTextureId(GLenum target); 456 GLuint BoundTextureId(GLenum target);
457 scoped_refptr<TestTexture> BoundTexture(GLenum target); 457 scoped_refptr<TestTexture> BoundTexture(GLenum target);
458 scoped_refptr<TestTexture> UnboundTexture(GLuint texture); 458 scoped_refptr<TestTexture> UnboundTexture(GLuint texture);
459 void CheckTextureIsBound(GLenum target); 459 void CheckTextureIsBound(GLenum target);
460 460
461 unsigned context_id_; 461 unsigned context_id_;
462 ContextProvider::Capabilities test_capabilities_; 462 ContextProvider::Capabilities test_capabilities_;
463 int times_bind_texture_succeeds_; 463 int times_bind_texture_succeeds_;
464 int times_end_query_succeeds_; 464 int times_end_query_succeeds_;
465 bool context_lost_; 465 bool context_lost_;
466 int times_map_buffer_chromium_succeeds_; 466 int times_map_buffer_chromium_succeeds_;
467 int current_used_transfer_buffer_usage_bytes_; 467 int current_used_transfer_buffer_usage_bytes_;
468 int max_used_transfer_buffer_usage_bytes_; 468 int max_used_transfer_buffer_usage_bytes_;
469 base::Closure context_lost_callback_; 469 base::Closure context_lost_callback_;
470 base::hash_set<unsigned> used_textures_; 470 std::unordered_set<unsigned> used_textures_;
471 unsigned next_program_id_; 471 unsigned next_program_id_;
472 base::hash_set<unsigned> program_set_; 472 std::unordered_set<unsigned> program_set_;
473 unsigned next_shader_id_; 473 unsigned next_shader_id_;
474 base::hash_set<unsigned> shader_set_; 474 std::unordered_set<unsigned> shader_set_;
475 unsigned next_framebuffer_id_; 475 unsigned next_framebuffer_id_;
476 base::hash_set<unsigned> framebuffer_set_; 476 std::unordered_set<unsigned> framebuffer_set_;
477 unsigned current_framebuffer_; 477 unsigned current_framebuffer_;
478 std::vector<TestWebGraphicsContext3D*> shared_contexts_; 478 std::vector<TestWebGraphicsContext3D*> shared_contexts_;
479 int max_texture_size_; 479 int max_texture_size_;
480 bool reshape_called_; 480 bool reshape_called_;
481 int width_; 481 int width_;
482 int height_; 482 int height_;
483 float scale_factor_; 483 float scale_factor_;
484 TestContextSupport* test_support_; 484 TestContextSupport* test_support_;
485 gfx::Rect update_rect_; 485 gfx::Rect update_rect_;
486 UpdateType last_update_type_; 486 UpdateType last_update_type_;
487 GLuint64 next_insert_fence_sync_; 487 GLuint64 next_insert_fence_sync_;
488 gpu::SyncToken last_waited_sync_token_; 488 gpu::SyncToken last_waited_sync_token_;
489 int unpack_alignment_; 489 int unpack_alignment_;
490 490
491 unsigned bound_buffer_; 491 unsigned bound_buffer_;
492 TextureTargets texture_targets_; 492 TextureTargets texture_targets_;
493 493
494 scoped_refptr<Namespace> namespace_; 494 scoped_refptr<Namespace> namespace_;
495 static Namespace* shared_namespace_; 495 static Namespace* shared_namespace_;
496 496
497 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; 497 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_;
498 }; 498 };
499 499
500 } // namespace cc 500 } // namespace cc
501 501
502 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ 502 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_
OLDNEW
« no previous file with comments | « cc/test/test_texture.h ('k') | cc/test/test_web_graphics_context_3d.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698