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

Unified Diff: cc/quads/render_pass.h

Issue 404563005: Make RenderPass::Id an isolated class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more case in mojo Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/quads/draw_quad_unittest.cc ('k') | cc/quads/render_pass.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/quads/render_pass.h
diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h
index 8d4114206351f01d6933e4e35650f93334c16d97..5b0c3b61be16f371cba040c5821e109bc58459b7 100644
--- a/cc/quads/render_pass.h
+++ b/cc/quads/render_pass.h
@@ -12,6 +12,7 @@
#include "base/containers/hash_tables.h"
#include "cc/base/cc_export.h"
#include "cc/base/scoped_ptr_vector.h"
+#include "cc/quads/render_pass_id.h"
#include "skia/ext/refptr.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_f.h"
@@ -47,25 +48,6 @@ typedef ScopedPtrVector<SharedQuadState> SharedQuadStateList;
class CC_EXPORT RenderPass {
public:
- struct Id {
- int layer_id;
- int index;
-
- Id(int layer_id, int index) : layer_id(layer_id), index(index) {}
- void* AsTracingId() const;
-
- bool operator==(const Id& other) const {
- return layer_id == other.layer_id && index == other.index;
- }
- bool operator!=(const Id& other) const {
- return !(*this == other);
- }
- bool operator<(const Id& other) const {
- return layer_id < other.layer_id ||
- (layer_id == other.layer_id && index < other.index);
- }
- };
-
~RenderPass();
static scoped_ptr<RenderPass> Create();
@@ -73,18 +55,18 @@ class CC_EXPORT RenderPass {
// A shallow copy of the render pass, which does not include its quads or copy
// requests.
- scoped_ptr<RenderPass> Copy(Id new_id) const;
+ scoped_ptr<RenderPass> Copy(RenderPassId new_id) const;
// A deep copy of the render passes in the list including the quads.
static void CopyAll(const ScopedPtrVector<RenderPass>& in,
ScopedPtrVector<RenderPass>* out);
- void SetNew(Id id,
+ void SetNew(RenderPassId id,
const gfx::Rect& output_rect,
const gfx::Rect& damage_rect,
const gfx::Transform& transform_to_root_target);
- void SetAll(Id id,
+ void SetAll(RenderPassId id,
const gfx::Rect& output_rect,
const gfx::Rect& damage_rect,
const gfx::Transform& transform_to_root_target,
@@ -103,12 +85,12 @@ class CC_EXPORT RenderPass {
RenderPassDrawQuad* CopyFromAndAppendRenderPassDrawQuad(
const RenderPassDrawQuad* quad,
const SharedQuadState* shared_quad_state,
- RenderPass::Id render_pass_id);
+ RenderPassId render_pass_id);
DrawQuad* CopyFromAndAppendDrawQuad(const DrawQuad* quad,
const SharedQuadState* shared_quad_state);
// Uniquely identifies the render pass in the compositor's current frame.
- Id id;
+ RenderPassId id;
// These are in the space of the render pass' physical pixels.
gfx::Rect output_rect;
@@ -150,13 +132,13 @@ class CC_EXPORT RenderPass {
namespace BASE_HASH_NAMESPACE {
#if defined(COMPILER_MSVC)
-inline size_t hash_value(const cc::RenderPass::Id& key) {
+inline size_t hash_value(const cc::RenderPassId& key) {
return base::HashPair(key.layer_id, key.index);
}
#elif defined(COMPILER_GCC)
-template<>
-struct hash<cc::RenderPass::Id> {
- size_t operator()(cc::RenderPass::Id key) const {
+template <>
+struct hash<cc::RenderPassId> {
+ size_t operator()(cc::RenderPassId key) const {
return base::HashPair(key.layer_id, key.index);
}
};
@@ -167,7 +149,7 @@ struct hash<cc::RenderPass::Id> {
namespace cc {
typedef ScopedPtrVector<RenderPass> RenderPassList;
-typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap;
+typedef base::hash_map<RenderPassId, RenderPass*> RenderPassIdHashMap;
} // namespace cc
#endif // CC_QUADS_RENDER_PASS_H_
« no previous file with comments | « cc/quads/draw_quad_unittest.cc ('k') | cc/quads/render_pass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698