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

Side by Side Diff: ui/android/delegated_frame_host_android.cc

Issue 2537943002: Getting rid of CompositorFrameMetadata::satisfies_sequences (Closed)
Patch Set: x 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/android/delegated_frame_host_android.h" 5 #include "ui/android/delegated_frame_host_android.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "cc/layers/solid_color_layer.h" 9 #include "cc/layers/solid_color_layer.h"
10 #include "cc/layers/surface_layer.h" 10 #include "cc/layers/surface_layer.h"
11 #include "cc/output/compositor_frame.h" 11 #include "cc/output/compositor_frame.h"
12 #include "cc/output/copy_output_result.h" 12 #include "cc/output/copy_output_result.h"
13 #include "cc/surfaces/surface.h" 13 #include "cc/surfaces/surface.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_id_allocator.h" 15 #include "cc/surfaces/surface_id_allocator.h"
16 #include "cc/surfaces/surface_manager.h" 16 #include "cc/surfaces/surface_manager.h"
17 #include "ui/android/context_provider_factory.h" 17 #include "ui/android/context_provider_factory.h"
18 #include "ui/android/view_android.h" 18 #include "ui/android/view_android.h"
19 #include "ui/android/window_android_compositor.h" 19 #include "ui/android/window_android_compositor.h"
20 #include "ui/display/display.h" 20 #include "ui/display/display.h"
21 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
22 #include "ui/gfx/geometry/dip_util.h" 22 #include "ui/gfx/geometry/dip_util.h"
23 23
24 namespace ui { 24 namespace ui {
25 25
26 namespace { 26 namespace {
27 27
28 void SatisfyCallback(cc::SurfaceManager* manager, 28 void SatisfyCallback(base::WeakPtr<cc::SurfaceManager> manager,
29 const cc::SurfaceSequence& sequence) { 29 const cc::SurfaceSequence& sequence) {
30 if (!manager)
31 return;
30 std::vector<uint32_t> sequences; 32 std::vector<uint32_t> sequences;
31 sequences.push_back(sequence.sequence); 33 sequences.push_back(sequence.sequence);
32 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); 34 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences);
33 } 35 }
34 36
35 void RequireCallback(cc::SurfaceManager* manager, 37 void RequireCallback(base::WeakPtr<cc::SurfaceManager> manager,
36 const cc::SurfaceId& id, 38 const cc::SurfaceId& id,
37 const cc::SurfaceSequence& sequence) { 39 const cc::SurfaceSequence& sequence) {
40 DCHECK(manager);
38 cc::Surface* surface = manager->GetSurfaceForId(id); 41 cc::Surface* surface = manager->GetSurfaceForId(id);
39 if (!surface) { 42 if (!surface) {
40 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; 43 LOG(ERROR) << "Attempting to require callback on nonexistent surface";
41 return; 44 return;
42 } 45 }
43 surface->AddDestructionDependency(sequence); 46 surface->AddDestructionDependency(sequence);
44 } 47 }
45 48
46 scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer( 49 scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer(
47 cc::SurfaceManager* surface_manager, 50 cc::SurfaceManager* surface_manager,
48 cc::SurfaceId surface_id, 51 cc::SurfaceId surface_id,
49 const gfx::Size surface_size, 52 const gfx::Size surface_size,
50 bool surface_opaque) { 53 bool surface_opaque) {
51 // manager must outlive compositors using it. 54 // manager must outlive compositors using it.
52 scoped_refptr<cc::SurfaceLayer> layer = cc::SurfaceLayer::Create( 55 scoped_refptr<cc::SurfaceLayer> layer = cc::SurfaceLayer::Create(
53 base::Bind(&SatisfyCallback, base::Unretained(surface_manager)), 56 base::Bind(&SatisfyCallback, surface_manager->GetWeakPtr()),
54 base::Bind(&RequireCallback, base::Unretained(surface_manager))); 57 base::Bind(&RequireCallback, surface_manager->GetWeakPtr()));
55 layer->SetSurfaceId(surface_id, 1.f, surface_size); 58 layer->SetSurfaceId(surface_id, 1.f, surface_size);
56 layer->SetBounds(surface_size); 59 layer->SetBounds(surface_size);
57 layer->SetIsDrawable(true); 60 layer->SetIsDrawable(true);
58 layer->SetContentsOpaque(surface_opaque); 61 layer->SetContentsOpaque(surface_opaque);
59 62
60 return layer; 63 return layer;
61 } 64 }
62 65
63 void CopyOutputRequestCallback( 66 void CopyOutputRequestCallback(
64 scoped_refptr<cc::Layer> readback_layer, 67 scoped_refptr<cc::Layer> readback_layer,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 content_size_in_dip.width() < container_size_in_dip_.width() || 270 content_size_in_dip.width() < container_size_in_dip_.width() ||
268 content_size_in_dip.height() < container_size_in_dip_.height(); 271 content_size_in_dip.height() < container_size_in_dip_.height();
269 } else { 272 } else {
270 background_is_drawable = true; 273 background_is_drawable = true;
271 } 274 }
272 275
273 background_layer_->SetIsDrawable(background_is_drawable); 276 background_layer_->SetIsDrawable(background_is_drawable);
274 } 277 }
275 278
276 } // namespace ui 279 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698