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

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

Issue 2661543002: Rename LocalFrameId to LocalSurfaceId (Closed)
Patch Set: c Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/android/delegated_frame_host_android.h ('k') | ui/compositor/layer_unittest.cc » ('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 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 "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/layers/solid_color_layer.h" 10 #include "cc/layers/solid_color_layer.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 current_frame_->bottom_controls_shown_ratio != 102 current_frame_->bottom_controls_shown_ratio !=
103 frame.metadata.bottom_controls_shown_ratio || 103 frame.metadata.bottom_controls_shown_ratio ||
104 current_frame_->viewport_selection != frame.metadata.selection || 104 current_frame_->viewport_selection != frame.metadata.selection ||
105 current_frame_->has_transparent_background != 105 current_frame_->has_transparent_background !=
106 root_pass->has_transparent_background) { 106 root_pass->has_transparent_background) {
107 DestroyDelegatedContent(); 107 DestroyDelegatedContent();
108 DCHECK(!content_layer_); 108 DCHECK(!content_layer_);
109 DCHECK(!current_frame_); 109 DCHECK(!current_frame_);
110 110
111 current_frame_ = base::MakeUnique<FrameData>(); 111 current_frame_ = base::MakeUnique<FrameData>();
112 current_frame_->local_frame_id = surface_id_allocator_->GenerateId(); 112 current_frame_->local_surface_id = surface_id_allocator_->GenerateId();
113 current_frame_->surface_size = surface_size; 113 current_frame_->surface_size = surface_size;
114 current_frame_->top_controls_height = frame.metadata.top_controls_height; 114 current_frame_->top_controls_height = frame.metadata.top_controls_height;
115 current_frame_->top_controls_shown_ratio = 115 current_frame_->top_controls_shown_ratio =
116 frame.metadata.top_controls_shown_ratio; 116 frame.metadata.top_controls_shown_ratio;
117 current_frame_->bottom_controls_height = 117 current_frame_->bottom_controls_height =
118 frame.metadata.bottom_controls_height; 118 frame.metadata.bottom_controls_height;
119 current_frame_->bottom_controls_shown_ratio = 119 current_frame_->bottom_controls_shown_ratio =
120 frame.metadata.bottom_controls_shown_ratio; 120 frame.metadata.bottom_controls_shown_ratio;
121 current_frame_->has_transparent_background = 121 current_frame_->has_transparent_background =
122 root_pass->has_transparent_background; 122 root_pass->has_transparent_background;
123 current_frame_->viewport_selection = frame.metadata.selection; 123 current_frame_->viewport_selection = frame.metadata.selection;
124 surface_factory_->SubmitCompositorFrame(current_frame_->local_frame_id, 124 surface_factory_->SubmitCompositorFrame(current_frame_->local_surface_id,
125 std::move(frame), draw_callback); 125 std::move(frame), draw_callback);
126 126
127 content_layer_ = CreateSurfaceLayer( 127 content_layer_ = CreateSurfaceLayer(
128 surface_manager_, cc::SurfaceId(surface_factory_->frame_sink_id(), 128 surface_manager_, cc::SurfaceId(surface_factory_->frame_sink_id(),
129 current_frame_->local_frame_id), 129 current_frame_->local_surface_id),
130 current_frame_->surface_size, 130 current_frame_->surface_size,
131 !current_frame_->has_transparent_background); 131 !current_frame_->has_transparent_background);
132 view_->GetLayer()->AddChild(content_layer_); 132 view_->GetLayer()->AddChild(content_layer_);
133 UpdateBackgroundLayer(); 133 UpdateBackgroundLayer();
134 } else { 134 } else {
135 surface_factory_->SubmitCompositorFrame(current_frame_->local_frame_id, 135 surface_factory_->SubmitCompositorFrame(current_frame_->local_surface_id,
136 std::move(frame), draw_callback); 136 std::move(frame), draw_callback);
137 } 137 }
138 } 138 }
139 139
140 cc::FrameSinkId DelegatedFrameHostAndroid::GetFrameSinkId() const { 140 cc::FrameSinkId DelegatedFrameHostAndroid::GetFrameSinkId() const {
141 return frame_sink_id_; 141 return frame_sink_id_;
142 } 142 }
143 143
144 void DelegatedFrameHostAndroid::RequestCopyOfSurface( 144 void DelegatedFrameHostAndroid::RequestCopyOfSurface(
145 WindowAndroidCompositor* compositor, 145 WindowAndroidCompositor* compositor,
146 const gfx::Rect& src_subrect_in_pixel, 146 const gfx::Rect& src_subrect_in_pixel,
147 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback) { 147 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback) {
148 DCHECK(current_frame_); 148 DCHECK(current_frame_);
149 DCHECK(!result_callback.is_null()); 149 DCHECK(!result_callback.is_null());
150 150
151 scoped_refptr<cc::Layer> readback_layer = CreateSurfaceLayer( 151 scoped_refptr<cc::Layer> readback_layer = CreateSurfaceLayer(
152 surface_manager_, cc::SurfaceId(surface_factory_->frame_sink_id(), 152 surface_manager_, cc::SurfaceId(surface_factory_->frame_sink_id(),
153 current_frame_->local_frame_id), 153 current_frame_->local_surface_id),
154 current_frame_->surface_size, 154 current_frame_->surface_size,
155 !current_frame_->has_transparent_background); 155 !current_frame_->has_transparent_background);
156 readback_layer->SetHideLayerAndSubtree(true); 156 readback_layer->SetHideLayerAndSubtree(true);
157 compositor->AttachLayerForReadback(readback_layer); 157 compositor->AttachLayerForReadback(readback_layer);
158 std::unique_ptr<cc::CopyOutputRequest> copy_output_request = 158 std::unique_ptr<cc::CopyOutputRequest> copy_output_request =
159 cc::CopyOutputRequest::CreateRequest(base::Bind( 159 cc::CopyOutputRequest::CreateRequest(base::Bind(
160 &CopyOutputRequestCallback, readback_layer, result_callback)); 160 &CopyOutputRequestCallback, readback_layer, result_callback));
161 161
162 if (!src_subrect_in_pixel.IsEmpty()) 162 if (!src_subrect_in_pixel.IsEmpty())
163 copy_output_request->set_area(src_subrect_in_pixel); 163 copy_output_request->set_area(src_subrect_in_pixel);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 content_size_in_dip.width() < container_size_in_dip_.width() || 246 content_size_in_dip.width() < container_size_in_dip_.width() ||
247 content_size_in_dip.height() < container_size_in_dip_.height(); 247 content_size_in_dip.height() < container_size_in_dip_.height();
248 } else { 248 } else {
249 background_is_drawable = true; 249 background_is_drawable = true;
250 } 250 }
251 251
252 background_layer_->SetIsDrawable(background_is_drawable); 252 background_layer_->SetIsDrawable(background_is_drawable);
253 } 253 }
254 254
255 } // namespace ui 255 } // namespace ui
OLDNEW
« no previous file with comments | « ui/android/delegated_frame_host_android.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698