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

Unified Diff: cc/test/test_compositor_frame_sink.cc

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 years, 2 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
Index: cc/test/test_compositor_frame_sink.cc
diff --git a/cc/test/test_compositor_frame_sink.cc b/cc/test/test_compositor_frame_sink.cc
index 1037fba98a6a5c9c482c9f7985c795b92cb919ba..6aab14575762150901ffbd8bb81c6aea407d47e2 100644
--- a/cc/test/test_compositor_frame_sink.cc
+++ b/cc/test/test_compositor_frame_sink.cc
@@ -14,10 +14,10 @@
#include "cc/output/output_surface.h"
#include "cc/output/texture_mailbox_deleter.h"
-static constexpr cc::FrameSinkId kCompositorFrameSinkId(1, 1);
-
namespace cc {
+static constexpr FrameSinkId kCompositorFrameSinkId(1, 1);
+
TestCompositorFrameSink::TestCompositorFrameSink(
scoped_refptr<ContextProvider> compositor_context_provider,
scoped_refptr<ContextProvider> worker_context_provider,
@@ -32,7 +32,7 @@ TestCompositorFrameSink::TestCompositorFrameSink(
std::move(worker_context_provider)),
frame_sink_id_(kCompositorFrameSinkId),
surface_manager_(new SurfaceManager),
- surface_id_allocator_(new SurfaceIdAllocator(frame_sink_id_)),
+ surface_id_allocator_(new SurfaceIdAllocator()),
surface_factory_(
new SurfaceFactory(frame_sink_id_, surface_manager_.get(), this)),
weak_ptrs_(this) {
@@ -103,8 +103,8 @@ bool TestCompositorFrameSink::BindToClient(CompositorFrameSinkClient* client) {
void TestCompositorFrameSink::DetachFromClient() {
// Some tests make BindToClient fail on purpose. ^__^
if (bound_) {
- if (!delegated_surface_id_.is_null())
- surface_factory_->Destroy(delegated_surface_id_);
+ if (!delegated_local_frame_id_.is_null())
+ surface_factory_->Destroy(delegated_local_frame_id_);
surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
bound_ = false;
@@ -121,11 +121,11 @@ void TestCompositorFrameSink::SwapBuffers(CompositorFrame frame) {
if (test_client_)
test_client_->DisplayReceivedCompositorFrame(frame);
- if (delegated_surface_id_.is_null()) {
- delegated_surface_id_ = surface_id_allocator_->GenerateId();
- surface_factory_->Create(delegated_surface_id_);
+ if (delegated_local_frame_id_.is_null()) {
+ delegated_local_frame_id_ = surface_id_allocator_->GenerateId();
+ surface_factory_->Create(delegated_local_frame_id_);
}
- display_->SetSurfaceId(delegated_surface_id_,
+ display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_),
frame.metadata.device_scale_factor);
gfx::Size frame_size =
@@ -135,13 +135,14 @@ void TestCompositorFrameSink::SwapBuffers(CompositorFrame frame) {
bool synchronous = !display_->has_scheduler();
surface_factory_->SubmitCompositorFrame(
- delegated_surface_id_, std::move(frame),
+ delegated_local_frame_id_, std::move(frame),
base::Bind(&TestCompositorFrameSink::DidDrawCallback,
weak_ptrs_.GetWeakPtr(), synchronous));
- for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_)
- surface_factory_->RequestCopyOfSurface(delegated_surface_id_,
+ for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_) {
+ surface_factory_->RequestCopyOfSurface(delegated_local_frame_id_,
std::move(copy_request));
+ }
copy_requests_.clear();
if (synchronous)
@@ -163,8 +164,8 @@ void TestCompositorFrameSink::DidDrawCallback(bool synchronous) {
void TestCompositorFrameSink::ForceReclaimResources() {
if (capabilities_.can_force_reclaim_resources &&
- !delegated_surface_id_.is_null()) {
- surface_factory_->SubmitCompositorFrame(delegated_surface_id_,
+ !delegated_local_frame_id_.is_null()) {
+ surface_factory_->SubmitCompositorFrame(delegated_local_frame_id_,
CompositorFrame(),
SurfaceFactory::DrawCallback());
}

Powered by Google App Engine
This is Rietveld 408576698