summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/surfaces/surface.cc19
-rw-r--r--cc/surfaces/surface_aggregator.cc10
-rw-r--r--cc/surfaces/surface_aggregator_unittest.cc12
-rw-r--r--cc/surfaces/surface_factory.cc5
-rw-r--r--cc/surfaces/surface_factory.h3
-rw-r--r--cc/surfaces/surface_factory_client.h5
-rw-r--r--cc/surfaces/surface_factory_unittest.cc58
7 files changed, 7 insertions, 105 deletions
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 0ffd522..32f41f1 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -101,22 +101,11 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
if (current_frame_ &&
- !current_frame_->delegated_frame_data->render_pass_list.empty()) {
- ScopedPtrVector<CopyOutputRequest>& copy_requests =
- current_frame_->delegated_frame_data->render_pass_list.back()
- ->copy_requests;
-
- if (void* source = copy_request->source()) {
- // Remove existing CopyOutputRequests made on the Surface by the same
- // source.
- auto to_remove = copy_requests.remove_if([source](
- const CopyOutputRequest* x) { return x->source() == source; });
- copy_requests.erase(to_remove, copy_requests.end());
- }
- copy_requests.push_back(copy_request.Pass());
- } else {
+ !current_frame_->delegated_frame_data->render_pass_list.empty())
+ current_frame_->delegated_frame_data->render_pass_list.back()
+ ->copy_requests.push_back(copy_request.Pass());
+ else
copy_request->SendEmptyResult();
- }
}
void Surface::TakeCopyOutputRequests(
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index 967f496..25c2584 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -571,6 +571,9 @@ gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) {
if (provider_)
provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources);
+ for (const auto& render_pass : frame_data->render_pass_list)
+ has_copy_requests_ |= !render_pass->copy_requests.empty();
+
gfx::Rect damage_rect;
if (!frame_data->render_pass_list.empty()) {
RenderPass* last_pass = frame_data->render_pass_list.back();
@@ -587,13 +590,6 @@ gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) {
damage_rect.Union(
MathUtil::MapEnclosingClippedRect(surface_info.second, surface_damage));
}
-
- if (surface->factory())
- surface->factory()->WillDrawSurface(surface->surface_id(), damage_rect);
-
- for (const auto& render_pass : frame_data->render_pass_list)
- has_copy_requests_ |= !render_pass->copy_requests.empty();
-
referenced_surfaces_.erase(it);
return damage_rect;
}
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 3c18dfe..7696b74 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -44,16 +44,8 @@ class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
public:
void ReturnResources(const ReturnedResourceArray& resources) override {}
- void WillDrawSurface(SurfaceId id, const gfx::Rect& damage_rect) override {
- last_surface_id_ = id;
- last_damage_rect_ = damage_rect;
- }
-
void SetBeginFrameSource(SurfaceId surface_id,
BeginFrameSource* begin_frame_source) override {}
-
- gfx::Rect last_damage_rect_;
- SurfaceId last_surface_id_;
};
class FakeSurfaceAggregatorClient : public SurfaceAggregatorClient {
@@ -211,10 +203,6 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) {
EXPECT_FALSE(surface_aggregator_client_.HasSurface(root_surface_));
AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids));
EXPECT_TRUE(surface_aggregator_client_.HasSurface(root_surface_));
-
- // Check that WillDrawSurface was called.
- EXPECT_EQ(gfx::Rect(SurfaceSize()), empty_client_.last_damage_rect_);
- EXPECT_EQ(root_surface_id_, empty_client_.last_surface_id_);
}
TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCopied) {
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index b71994e..b35380e 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -82,11 +82,6 @@ void SurfaceFactory::RequestCopyOfSurface(
manager_->SurfaceModified(surface_id);
}
-void SurfaceFactory::WillDrawSurface(SurfaceId id,
- const gfx::Rect& damage_rect) {
- client_->WillDrawSurface(id, damage_rect);
-}
-
void SurfaceFactory::ReceiveFromChild(
const TransferableResourceArray& resources) {
holder_.ReceiveFromChild(resources);
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h
index 1347728..e8e4e9d 100644
--- a/cc/surfaces/surface_factory.h
+++ b/cc/surfaces/surface_factory.h
@@ -11,7 +11,6 @@
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/observer_list.h"
#include "cc/output/compositor_frame.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_resource_holder.h"
@@ -61,8 +60,6 @@ class CC_SURFACES_EXPORT SurfaceFactory
void RequestCopyOfSurface(SurfaceId surface_id,
scoped_ptr<CopyOutputRequest> copy_request);
- void WillDrawSurface(SurfaceId id, const gfx::Rect& damage_rect);
-
SurfaceFactoryClient* client() { return client_; }
void ReceiveFromChild(const TransferableResourceArray& resources);
diff --git a/cc/surfaces/surface_factory_client.h b/cc/surfaces/surface_factory_client.h
index e79b185..169910a 100644
--- a/cc/surfaces/surface_factory_client.h
+++ b/cc/surfaces/surface_factory_client.h
@@ -6,9 +6,7 @@
#define CC_SURFACES_SURFACE_FACTORY_CLIENT_H_
#include "cc/resources/returned_resource.h"
-#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surfaces_export.h"
-#include "ui/gfx/geometry/rect.h"
namespace cc {
@@ -21,9 +19,6 @@ class CC_SURFACES_EXPORT SurfaceFactoryClient {
virtual void ReturnResources(const ReturnedResourceArray& resources) = 0;
- virtual void WillDrawSurface(SurfaceId surface_id,
- const gfx::Rect& damage_rect) {}
-
// This allows the SurfaceFactory to tell it's client what BeginFrameSource
// to use for a given surface_id.
// If there are multiple active surface_ids, it is the client's
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
index d516aa3..9e7bc153 100644
--- a/cc/surfaces/surface_factory_unittest.cc
+++ b/cc/surfaces/surface_factory_unittest.cc
@@ -4,8 +4,6 @@
#include "base/bind.h"
#include "cc/output/compositor_frame.h"
-#include "cc/output/copy_output_request.h"
-#include "cc/output/copy_output_result.h"
#include "cc/output/delegated_frame_data.h"
#include "cc/resources/resource_provider.h"
#include "cc/surfaces/surface.h"
@@ -531,62 +529,6 @@ TEST_F(SurfaceFactoryTest, DestroyCycle) {
surface_id_ = SurfaceId();
}
-void CopyRequestTestCallback(bool* called,
- scoped_ptr<CopyOutputResult> result) {
- *called = true;
-}
-
-TEST_F(SurfaceFactoryTest, DuplicateCopyRequest) {
- {
- scoped_ptr<RenderPass> render_pass(RenderPass::Create());
- render_pass->referenced_surfaces.push_back(surface_id_);
- scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
- frame_data->render_pass_list.push_back(render_pass.Pass());
- scoped_ptr<CompositorFrame> frame(new CompositorFrame);
- frame->delegated_frame_data = frame_data.Pass();
- factory_->SubmitCompositorFrame(surface_id_, frame.Pass(),
- SurfaceFactory::DrawCallback());
- }
- void* source1 = &source1;
- void* source2 = &source2;
-
- bool called1 = false;
- scoped_ptr<CopyOutputRequest> request;
- request = CopyOutputRequest::CreateRequest(
- base::Bind(&CopyRequestTestCallback, &called1));
- request->set_source(source1);
-
- factory_->RequestCopyOfSurface(surface_id_, request.Pass());
- EXPECT_FALSE(called1);
-
- bool called2 = false;
- request = CopyOutputRequest::CreateRequest(
- base::Bind(&CopyRequestTestCallback, &called2));
- request->set_source(source2);
-
- factory_->RequestCopyOfSurface(surface_id_, request.Pass());
- // Callbacks have different sources so neither should be called.
- EXPECT_FALSE(called1);
- EXPECT_FALSE(called2);
-
- bool called3 = false;
- request = CopyOutputRequest::CreateRequest(
- base::Bind(&CopyRequestTestCallback, &called3));
- request->set_source(source1);
-
- factory_->RequestCopyOfSurface(surface_id_, request.Pass());
- // Two callbacks are from source1, so the first should be called.
- EXPECT_TRUE(called1);
- EXPECT_FALSE(called2);
- EXPECT_FALSE(called3);
-
- factory_->Destroy(surface_id_);
- surface_id_ = SurfaceId();
- EXPECT_TRUE(called1);
- EXPECT_TRUE(called2);
- EXPECT_TRUE(called3);
-}
-
// Verifies BFS is forwarded to the client.
TEST_F(SurfaceFactoryTest, SetBeginFrameSource) {
FakeBeginFrameSource bfs1;