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

Side by Side Diff: blimp/client/core/compositor/blimp_compositor.cc

Issue 2585543003: Revert of Getting rid of CompositorFrameMetadata::satisfies_sequences (Closed)
Patch Set: Created 4 years 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 | « no previous file | cc/ipc/cc_param_traits_macros.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "blimp/client/core/compositor/blimp_compositor.h" 5 #include "blimp/client/core/compositor/blimp_compositor.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 22 matching lines...) Expand all
33 #include "cc/trees/layer_tree_host_in_process.h" 33 #include "cc/trees/layer_tree_host_in_process.h"
34 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 34 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
35 #include "net/base/net_errors.h" 35 #include "net/base/net_errors.h"
36 #include "ui/gl/gl_surface.h" 36 #include "ui/gl/gl_surface.h"
37 37
38 namespace blimp { 38 namespace blimp {
39 namespace client { 39 namespace client {
40 40
41 namespace { 41 namespace {
42 42
43 void SatisfyCallback(base::WeakPtr<cc::SurfaceManager> manager, 43 void SatisfyCallback(cc::SurfaceManager* manager,
44 const cc::SurfaceSequence& sequence) { 44 const cc::SurfaceSequence& sequence) {
45 if (!manager)
46 return;
47 std::vector<uint32_t> sequences; 45 std::vector<uint32_t> sequences;
48 sequences.push_back(sequence.sequence); 46 sequences.push_back(sequence.sequence);
49 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); 47 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences);
50 } 48 }
51 49
52 void RequireCallback(base::WeakPtr<cc::SurfaceManager> manager, 50 void RequireCallback(cc::SurfaceManager* manager,
53 const cc::SurfaceId& id, 51 const cc::SurfaceId& id,
54 const cc::SurfaceSequence& sequence) { 52 const cc::SurfaceSequence& sequence) {
55 cc::Surface* surface = manager->GetSurfaceForId(id); 53 cc::Surface* surface = manager->GetSurfaceForId(id);
56 if (!surface) { 54 if (!surface) {
57 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; 55 LOG(ERROR) << "Attempting to require callback on nonexistent surface";
58 return; 56 return;
59 } 57 }
60 surface->AddDestructionDependency(sequence); 58 surface->AddDestructionDependency(sequence);
61 } 59 }
62 60
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 DestroyDelegatedContent(); 323 DestroyDelegatedContent();
326 DCHECK(layer_->children().empty()); 324 DCHECK(layer_->children().empty());
327 325
328 local_frame_id_ = surface_id_allocator_->GenerateId(); 326 local_frame_id_ = surface_id_allocator_->GenerateId();
329 current_surface_size_ = surface_size; 327 current_surface_size_ = surface_size;
330 328
331 // manager must outlive compositors using it. 329 // manager must outlive compositors using it.
332 cc::SurfaceManager* surface_manager = 330 cc::SurfaceManager* surface_manager =
333 GetEmbedderDeps()->GetSurfaceManager(); 331 GetEmbedderDeps()->GetSurfaceManager();
334 scoped_refptr<cc::SurfaceLayer> content_layer = cc::SurfaceLayer::Create( 332 scoped_refptr<cc::SurfaceLayer> content_layer = cc::SurfaceLayer::Create(
335 base::Bind(&SatisfyCallback, surface_manager->GetWeakPtr()), 333 base::Bind(&SatisfyCallback, base::Unretained(surface_manager)),
336 base::Bind(&RequireCallback, surface_manager->GetWeakPtr())); 334 base::Bind(&RequireCallback, base::Unretained(surface_manager)));
337 content_layer->SetSurfaceId( 335 content_layer->SetSurfaceId(
338 cc::SurfaceId(surface_factory_->frame_sink_id(), local_frame_id_), 1.f, 336 cc::SurfaceId(surface_factory_->frame_sink_id(), local_frame_id_), 1.f,
339 surface_size, false /* strecth_content_to_fill_bounds */); 337 surface_size, false /* strecth_content_to_fill_bounds */);
340 content_layer->SetBounds(current_surface_size_); 338 content_layer->SetBounds(current_surface_size_);
341 content_layer->SetIsDrawable(true); 339 content_layer->SetIsDrawable(true);
342 content_layer->SetContentsOpaque(true); 340 content_layer->SetContentsOpaque(true);
343 341
344 layer_->AddChild(content_layer); 342 layer_->AddChild(content_layer);
345 } 343 }
346 344
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // Destroy the old LayerTreeHost state. 460 // Destroy the old LayerTreeHost state.
463 host_.reset(); 461 host_.reset();
464 462
465 // Cancel any outstanding CompositorFrameSink requests. That way if we get an 463 // Cancel any outstanding CompositorFrameSink requests. That way if we get an
466 // async callback related to the old request we know to drop it. 464 // async callback related to the old request we know to drop it.
467 compositor_frame_sink_request_pending_ = false; 465 compositor_frame_sink_request_pending_ = false;
468 } 466 }
469 467
470 } // namespace client 468 } // namespace client
471 } // namespace blimp 469 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | cc/ipc/cc_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698