summaryrefslogtreecommitdiffstats
path: root/cc/surfaces
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-02 06:52:46 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-02 06:52:46 +0000
commitcde7921316422aad0569127571623afd099df5f1 (patch)
treef54abf318581399ab25d48dbb27f88de756fd9ef /cc/surfaces
parentc6c2f06f650af6b9b05d3040d49111dce9deba59 (diff)
downloadchromium_src-cde7921316422aad0569127571623afd099df5f1.zip
chromium_src-cde7921316422aad0569127571623afd099df5f1.tar.gz
chromium_src-cde7921316422aad0569127571623afd099df5f1.tar.bz2
Allocate surface IDs on client side
This is much easier to manage for clients using surfaces in an asynchronous way (i.e. over a mojo pipe or chromium IPC). The code translating from the IPC layer to SurfaceFactory can validate that the namespace of SurfaceIds matches the logical connection it is managing. Review URL: https://codereview.chromium.org/358003003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/surfaces')
-rw-r--r--cc/surfaces/display.cc15
-rw-r--r--cc/surfaces/display.h11
-rw-r--r--cc/surfaces/surface_aggregator_unittest.cc40
-rw-r--r--cc/surfaces/surface_factory.cc9
-rw-r--r--cc/surfaces/surface_factory.h2
-rw-r--r--cc/surfaces/surface_factory_unittest.cc6
-rw-r--r--cc/surfaces/surface_id.h8
-rw-r--r--cc/surfaces/surface_id_allocator.cc24
-rw-r--r--cc/surfaces/surface_id_allocator.h33
-rw-r--r--cc/surfaces/surface_manager.cc7
-rw-r--r--cc/surfaces/surface_manager.h3
-rw-r--r--cc/surfaces/surface_unittest.cc5
-rw-r--r--cc/surfaces/surfaces_pixeltest.cc23
13 files changed, 122 insertions, 64 deletions
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index 30e593d..944ca5d 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -14,29 +14,20 @@
#include "cc/surfaces/display_client.h"
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_aggregator.h"
-#include "cc/surfaces/surface_factory.h"
namespace cc {
Display::Display(DisplayClient* client,
SurfaceManager* manager,
- SurfaceFactory* factory,
SharedBitmapManager* bitmap_manager)
- : client_(client),
- manager_(manager),
- bitmap_manager_(bitmap_manager),
- factory_(factory) {
+ : client_(client), manager_(manager), bitmap_manager_(bitmap_manager) {
}
Display::~Display() {
}
-void Display::Resize(const gfx::Size& size) {
- if (size == current_surface_size_)
- return;
- if (!current_surface_id_.is_null())
- factory_->Destroy(current_surface_id_);
- current_surface_id_ = factory_->Create(size);
+void Display::Resize(SurfaceId id, const gfx::Size& size) {
+ current_surface_id_ = id;
current_surface_size_ = size;
}
diff --git a/cc/surfaces/display.h b/cc/surfaces/display.h
index 689045b..b032afb 100644
--- a/cc/surfaces/display.h
+++ b/cc/surfaces/display.h
@@ -26,24 +26,22 @@ class ResourceProvider;
class SharedBitmapManager;
class Surface;
class SurfaceAggregator;
+class SurfaceIdAllocator;
class SurfaceFactory;
class SurfaceManager;
// A Display produces a surface that can be used to draw to a physical display
-// (OutputSurface). Since a surface is a fixed size and displays can resize, a
-// Display may create/destroy surfaces over its lifetime. Frames submitted to a
-// display's surface will have their resources returned through the factory's
-// client.
+// (OutputSurface). The client is responsible for creating and sizing the
+// surface IDs used to draw into the display and deciding when to draw.
class CC_SURFACES_EXPORT Display : public OutputSurfaceClient,
public RendererClient {
public:
Display(DisplayClient* client,
SurfaceManager* manager,
- SurfaceFactory* factory,
SharedBitmapManager* bitmap_manager);
virtual ~Display();
- void Resize(const gfx::Size& new_size);
+ void Resize(SurfaceId id, const gfx::Size& new_size);
bool Draw();
SurfaceId CurrentSurfaceId();
@@ -78,7 +76,6 @@ class CC_SURFACES_EXPORT Display : public OutputSurfaceClient,
DisplayClient* client_;
SurfaceManager* manager_;
SharedBitmapManager* bitmap_manager_;
- SurfaceFactory* factory_;
SurfaceId current_surface_id_;
gfx::Size current_surface_size_;
LayerTreeSettings settings_;
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 28ee1ed..98e20ee 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -15,6 +15,7 @@
#include "cc/surfaces/surface_aggregator_test_helpers.h"
#include "cc/surfaces/surface_factory.h"
#include "cc/surfaces/surface_factory_client.h"
+#include "cc/surfaces/surface_id_allocator.h"
#include "cc/surfaces/surface_manager.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
@@ -57,7 +58,8 @@ class SurfaceAggregatorTest : public testing::Test {
};
TEST_F(SurfaceAggregatorTest, ValidSurfaceNoFrame) {
- SurfaceId one_id = factory_.Create(SurfaceSize());
+ SurfaceId one_id(7);
+ factory_.Create(one_id, SurfaceSize());
scoped_ptr<CompositorFrame> frame = aggregator_.Aggregate(one_id);
EXPECT_FALSE(frame);
factory_.Destroy(one_id);
@@ -65,11 +67,12 @@ TEST_F(SurfaceAggregatorTest, ValidSurfaceNoFrame) {
class SurfaceAggregatorValidSurfaceTest : public SurfaceAggregatorTest {
public:
- SurfaceAggregatorValidSurfaceTest() {}
+ SurfaceAggregatorValidSurfaceTest() : allocator_(1u) {}
virtual void SetUp() {
SurfaceAggregatorTest::SetUp();
- root_surface_id_ = factory_.Create(SurfaceSize());
+ root_surface_id_ = allocator_.GenerateId();
+ factory_.Create(root_surface_id_, SurfaceSize());
}
virtual void TearDown() {
@@ -119,6 +122,7 @@ class SurfaceAggregatorValidSurfaceTest : public SurfaceAggregatorTest {
protected:
SurfaceId root_surface_id_;
+ SurfaceIdAllocator allocator_;
};
// Tests that a very simple frame containing only two solid color quads makes it
@@ -151,7 +155,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) {
// embedded_surface has a frame containing only a solid color quad. The solid
// color quad should be aggregated into the final frame.
TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) {
- SurfaceId embedded_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId embedded_surface_id = allocator_.GenerateId();
+ factory_.Create(embedded_surface_id, SurfaceSize());
test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)};
test::Pass embedded_passes[] = {
@@ -178,7 +183,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) {
// This tests referencing a surface that has multiple render passes.
TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSurfaceReference) {
- SurfaceId embedded_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId embedded_surface_id = allocator_.GenerateId();
+ factory_.Create(embedded_surface_id, SurfaceSize());
RenderPass::Id pass_ids[] = {RenderPass::Id(1, 1), RenderPass::Id(1, 2),
RenderPass::Id(1, 3)};
@@ -328,7 +334,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, InvalidSurfaceReference) {
// Tests a reference to a valid surface with no submitted frame. This quad
// should also just be dropped.
TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) {
- SurfaceId surface_with_no_frame_id = factory_.Create(gfx::Size(5, 5));
+ SurfaceId surface_with_no_frame_id = allocator_.GenerateId();
+ factory_.Create(surface_with_no_frame_id, gfx::Size(5, 5));
test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
test::Quad::SurfaceQuad(surface_with_no_frame_id),
test::Quad::SolidColorQuad(SK_ColorBLUE)};
@@ -361,7 +368,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleCyclicalReference) {
// Tests a more complex cycle with one intermediate surface.
TEST_F(SurfaceAggregatorValidSurfaceTest, TwoSurfaceCyclicalReference) {
- SurfaceId child_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId child_surface_id = allocator_.GenerateId();
+ factory_.Create(child_surface_id, SurfaceSize());
test::Quad parent_quads[] = {test::Quad::SolidColorQuad(SK_ColorBLUE),
test::Quad::SurfaceQuad(child_surface_id),
@@ -397,7 +405,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, TwoSurfaceCyclicalReference) {
// Tests that we map render pass IDs from different surfaces into a unified
// namespace and update RenderPassDrawQuad's id references to match.
TEST_F(SurfaceAggregatorValidSurfaceTest, RenderPassIdMapping) {
- SurfaceId child_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId child_surface_id = allocator_.GenerateId();
+ factory_.Create(child_surface_id, SurfaceSize());
RenderPass::Id child_pass_id[] = {RenderPass::Id(1, 1), RenderPass::Id(1, 2)};
test::Quad child_quad[][1] = {{test::Quad::SolidColorQuad(SK_ColorGREEN)},
@@ -525,7 +534,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) {
};
RenderPass::Id pass_id(1, 1);
- SurfaceId grandchild_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId grandchild_surface_id = allocator_.GenerateId();
+ factory_.Create(grandchild_surface_id, SurfaceSize());
scoped_ptr<RenderPass> grandchild_pass = RenderPass::Create();
gfx::Rect output_rect(SurfaceSize());
gfx::Rect damage_rect(SurfaceSize());
@@ -536,7 +546,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) {
SurfaceSize(), grandchild_pass.get(), blend_modes[2]);
QueuePassAsFrame(grandchild_pass.Pass(), grandchild_surface_id);
- SurfaceId child_one_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId child_one_surface_id = allocator_.GenerateId();
+ factory_.Create(child_one_surface_id, SurfaceSize());
scoped_ptr<RenderPass> child_one_pass = RenderPass::Create();
child_one_pass->SetNew(
@@ -555,7 +566,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) {
SurfaceSize(), child_one_pass.get(), blend_modes[3]);
QueuePassAsFrame(child_one_pass.Pass(), child_one_surface_id);
- SurfaceId child_two_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId child_two_surface_id = allocator_.GenerateId();
+ factory_.Create(child_two_surface_id, SurfaceSize());
scoped_ptr<RenderPass> child_two_pass = RenderPass::Create();
child_two_pass->SetNew(
@@ -632,7 +644,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) {
// contributing render pass' transform in the aggregate frame should not be
// affected.
TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) {
- SurfaceId child_surface_id = factory_.Create(SurfaceSize());
+ SurfaceId child_surface_id = allocator_.GenerateId();
+ factory_.Create(child_surface_id, SurfaceSize());
RenderPass::Id child_pass_id[] = {RenderPass::Id(1, 1), RenderPass::Id(1, 2)};
test::Quad child_quads[][1] = {
{test::Quad::SolidColorQuad(SK_ColorGREEN)},
@@ -846,7 +859,8 @@ void SubmitFrameWithResources(ResourceProvider::ResourceId* resource_ids,
TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) {
ResourceTrackingSurfaceFactoryClient client;
SurfaceFactory factory(&manager_, &client);
- SurfaceId surface_id = factory.Create(SurfaceSize());
+ SurfaceId surface_id(7u);
+ factory.Create(surface_id, SurfaceSize());
ResourceProvider::ResourceId ids[] = {11, 12, 13};
SubmitFrameWithResources(ids, arraysize(ids), &factory, surface_id);
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 09c9f45..69ee02a 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -19,12 +19,11 @@ SurfaceFactory::~SurfaceFactory() {
DCHECK_EQ(0u, surface_map_.size());
}
-SurfaceId SurfaceFactory::Create(const gfx::Size& size) {
- SurfaceId id = manager_->AllocateId();
- scoped_ptr<Surface> surface(new Surface(id, size, this));
+void SurfaceFactory::Create(SurfaceId surface_id, const gfx::Size& size) {
+ scoped_ptr<Surface> surface(new Surface(surface_id, size, this));
manager_->RegisterSurface(surface.get());
- surface_map_.add(id, surface.Pass());
- return id;
+ DCHECK(!surface_map_.count(surface_id));
+ surface_map_.add(surface_id, surface.Pass());
}
void SurfaceFactory::Destroy(SurfaceId surface_id) {
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h
index 5ea85d4..c74f973 100644
--- a/cc/surfaces/surface_factory.h
+++ b/cc/surfaces/surface_factory.h
@@ -33,7 +33,7 @@ class CC_SURFACES_EXPORT SurfaceFactory
SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client);
~SurfaceFactory();
- SurfaceId Create(const gfx::Size& size);
+ void Create(SurfaceId surface_id, const gfx::Size& size);
void Destroy(SurfaceId surface_id);
// A frame can only be submitted to a surface created by this factory,
// although the frame may reference surfaces created by other factories.
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
index f6244e8..886c246 100644
--- a/cc/surfaces/surface_factory_unittest.cc
+++ b/cc/surfaces/surface_factory_unittest.cc
@@ -39,9 +39,9 @@ class TestSurfaceFactoryClient : public SurfaceFactoryClient {
class SurfaceFactoryTest : public testing::Test {
public:
- SurfaceFactoryTest()
- : factory_(&manager_, &client_),
- surface_id_(factory_.Create(gfx::Size(5, 5))) {}
+ SurfaceFactoryTest() : factory_(&manager_, &client_), surface_id_(3) {
+ factory_.Create(surface_id_, gfx::Size(5, 5));
+ }
virtual ~SurfaceFactoryTest() { factory_.Destroy(surface_id_); }
diff --git a/cc/surfaces/surface_id.h b/cc/surfaces/surface_id.h
index 9b59f64..fa17286 100644
--- a/cc/surfaces/surface_id.h
+++ b/cc/surfaces/surface_id.h
@@ -12,11 +12,11 @@ namespace cc {
struct SurfaceId {
SurfaceId() : id(0) {}
- explicit SurfaceId(int id) : id(id) {}
+ explicit SurfaceId(uint64_t id) : id(id) {}
bool is_null() const { return id == 0; }
- int id;
+ uint64_t id;
};
inline bool operator==(const SurfaceId& a, const SurfaceId& b) {
@@ -41,7 +41,9 @@ inline size_t hash_value(const cc::SurfaceId& key) {
#elif defined(COMPILER_GCC)
template <>
struct hash<cc::SurfaceId> {
- size_t operator()(cc::SurfaceId key) const { return hash<int>()(key.id); }
+ size_t operator()(cc::SurfaceId key) const {
+ return hash<uint64_t>()(key.id);
+ }
};
#else
#error define a hash function for your compiler
diff --git a/cc/surfaces/surface_id_allocator.cc b/cc/surfaces/surface_id_allocator.cc
new file mode 100644
index 0000000..af9e91b
--- /dev/null
+++ b/cc/surfaces/surface_id_allocator.cc
@@ -0,0 +1,24 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/surfaces/surface_id_allocator.h"
+
+namespace cc {
+
+SurfaceIdAllocator::SurfaceIdAllocator(uint32_t id_namespace)
+ : id_namespace_(id_namespace), next_id_(1u) {
+}
+
+SurfaceId SurfaceIdAllocator::GenerateId() {
+ SurfaceId id(static_cast<uint64_t>(id_namespace_) << 32 | next_id_);
+ next_id_++;
+ return id;
+}
+
+// static
+uint32_t SurfaceIdAllocator::NamespaceForId(SurfaceId id) {
+ return id.id >> 32;
+}
+
+} // namespace cc
diff --git a/cc/surfaces/surface_id_allocator.h b/cc/surfaces/surface_id_allocator.h
new file mode 100644
index 0000000..57deffa
--- /dev/null
+++ b/cc/surfaces/surface_id_allocator.h
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SURFACES_SURFACE_ID_ALLOCATOR_H_
+#define CC_SURFACES_SURFACE_ID_ALLOCATOR_H_
+
+#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surfaces_export.h"
+
+namespace cc {
+
+// This is a helper class for generating surface IDs within a specified
+// namespace. This is not threadsafe, to use from multiple threads wrap this
+// class in a mutex.
+class CC_SURFACES_EXPORT SurfaceIdAllocator {
+ public:
+ explicit SurfaceIdAllocator(uint32_t id_namespace);
+
+ SurfaceId GenerateId();
+
+ static uint32_t NamespaceForId(SurfaceId id);
+
+ private:
+ uint32_t id_namespace_;
+ uint32_t next_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(SurfaceIdAllocator);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_SURFACE_ID_ALLOCATOR_H_
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc
index 77ad3c1..7027abd 100644
--- a/cc/surfaces/surface_manager.cc
+++ b/cc/surfaces/surface_manager.cc
@@ -9,18 +9,13 @@
namespace cc {
-SurfaceManager::SurfaceManager() : next_surface_id_(1) {
+SurfaceManager::SurfaceManager() {
}
SurfaceManager::~SurfaceManager() {
DCHECK_EQ(0u, surface_map_.size());
}
-SurfaceId SurfaceManager::AllocateId() {
- int surface_id = next_surface_id_++;
- return SurfaceId(surface_id);
-}
-
void SurfaceManager::RegisterSurface(Surface* surface) {
DCHECK(surface);
DCHECK(!surface_map_.count(surface->surface_id()));
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index 726ed85..40e55f1 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -19,7 +19,6 @@ class CC_SURFACES_EXPORT SurfaceManager {
SurfaceManager();
~SurfaceManager();
- SurfaceId AllocateId();
void RegisterSurface(Surface* surface);
void DeregisterSurface(SurfaceId surface_id);
@@ -29,8 +28,6 @@ class CC_SURFACES_EXPORT SurfaceManager {
typedef base::hash_map<SurfaceId, Surface*> SurfaceMap;
SurfaceMap surface_map_;
- int next_surface_id_;
-
DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
};
diff --git a/cc/surfaces/surface_unittest.cc b/cc/surfaces/surface_unittest.cc
index 7d91b0a..d2b1dfa 100644
--- a/cc/surfaces/surface_unittest.cc
+++ b/cc/surfaces/surface_unittest.cc
@@ -15,10 +15,9 @@ TEST(SurfaceTest, SurfaceLifetime) {
SurfaceManager manager;
SurfaceFactory factory(&manager, NULL);
- SurfaceId surface_id;
+ SurfaceId surface_id(6);
{
- surface_id = factory.Create(gfx::Size(5, 5));
- EXPECT_TRUE(!surface_id.is_null());
+ factory.Create(surface_id, gfx::Size(5, 5));
EXPECT_TRUE(!!manager.GetSurfaceForId(surface_id));
factory.Destroy(surface_id);
}
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc
index 6947abc..c814aaf 100644
--- a/cc/surfaces/surfaces_pixeltest.cc
+++ b/cc/surfaces/surfaces_pixeltest.cc
@@ -10,6 +10,7 @@
#include "cc/surfaces/surface_aggregator.h"
#include "cc/surfaces/surface_factory.h"
#include "cc/surfaces/surface_factory_client.h"
+#include "cc/surfaces/surface_id_allocator.h"
#include "cc/surfaces/surface_manager.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/pixel_test.h"
@@ -28,10 +29,11 @@ class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
public:
- SurfacesPixelTest() : factory_(&manager_, &client_) {}
+ SurfacesPixelTest() : allocator_(1u), factory_(&manager_, &client_) {}
protected:
SurfaceManager manager_;
+ SurfaceIdAllocator allocator_;
EmptySurfaceFactoryClient client_;
SurfaceFactory factory_;
};
@@ -83,7 +85,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) {
scoped_ptr<CompositorFrame> root_frame(new CompositorFrame);
root_frame->delegated_frame_data = delegated_frame_data.Pass();
- SurfaceId root_surface_id = factory_.Create(device_viewport_size_);
+ SurfaceId root_surface_id = allocator_.GenerateId();
+ factory_.Create(root_surface_id, device_viewport_size_);
factory_.SubmitFrame(root_surface_id, root_frame.Pass());
SurfaceAggregator aggregator(&manager_, resource_provider_.get());
@@ -103,9 +106,10 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) {
// Draws a frame with simple surface embedding.
TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
gfx::Size child_size(200, 100);
- SurfaceId child_surface_id = factory_.Create(child_size);
- SurfaceId root_surface_id = factory_.Create(device_viewport_size_);
-
+ SurfaceId child_surface_id = allocator_.GenerateId();
+ SurfaceId root_surface_id = allocator_.GenerateId();
+ factory_.Create(child_surface_id, child_size);
+ factory_.Create(root_surface_id, device_viewport_size_);
{
gfx::Rect rect(device_viewport_size_);
RenderPass::Id id(1, 1);
@@ -193,9 +197,12 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
// bottom_blue_quad (100x100 @ 0x100)
// right_child -> top_blue_quad (100x100 @ 0x0),
// bottom_green_quad (100x100 @ 0x100)
- SurfaceId left_child_id = factory_.Create(child_size);
- SurfaceId right_child_id = factory_.Create(child_size);
- SurfaceId root_surface_id = factory_.Create(device_viewport_size_);
+ SurfaceId left_child_id = allocator_.GenerateId();
+ SurfaceId right_child_id = allocator_.GenerateId();
+ SurfaceId root_surface_id = allocator_.GenerateId();
+ factory_.Create(left_child_id, child_size);
+ factory_.Create(right_child_id, child_size);
+ factory_.Create(root_surface_id, device_viewport_size_);
{
gfx::Rect rect(device_viewport_size_);