| OLD | NEW |
| 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 "android_webview/browser/surfaces_instance.h" | 5 #include "android_webview/browser/surfaces_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_gl_surface.h" | 10 #include "android_webview/browser/aw_gl_surface.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 quad_state->is_clipped = true; | 127 quad_state->is_clipped = true; |
| 128 quad_state->opacity = 1.f; | 128 quad_state->opacity = 1.f; |
| 129 | 129 |
| 130 cc::SurfaceDrawQuad* surface_quad = | 130 cc::SurfaceDrawQuad* surface_quad = |
| 131 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); | 131 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
| 132 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), | 132 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), |
| 133 gfx::Rect(quad_state->quad_layer_bounds), child_id, | 133 gfx::Rect(quad_state->quad_layer_bounds), child_id, |
| 134 cc::SurfaceDrawQuadType::PRIMARY, nullptr); | 134 cc::SurfaceDrawQuadType::PRIMARY, nullptr); |
| 135 | 135 |
| 136 cc::CompositorFrame frame; | 136 cc::CompositorFrame frame; |
| 137 // We draw synchronously, so acknowledge a manual BeginFrame. |
| 138 frame.metadata.begin_frame_ack = |
| 139 cc::BeginFrameAck(cc::BeginFrameArgs::kManualSourceId, |
| 140 cc::BeginFrameArgs::kStartingFrameNumber, |
| 141 cc::BeginFrameArgs::kStartingFrameNumber, 0, true); |
| 137 frame.render_pass_list.push_back(std::move(render_pass)); | 142 frame.render_pass_list.push_back(std::move(render_pass)); |
| 138 frame.metadata.referenced_surfaces = child_ids_; | 143 frame.metadata.referenced_surfaces = child_ids_; |
| 139 | 144 |
| 140 if (!root_id_.is_valid()) { | 145 if (!root_id_.is_valid()) { |
| 141 root_id_ = local_surface_id_allocator_->GenerateId(); | 146 root_id_ = local_surface_id_allocator_->GenerateId(); |
| 142 display_->SetLocalSurfaceId(root_id_, 1.f); | 147 display_->SetLocalSurfaceId(root_id_, 1.f); |
| 143 } | 148 } |
| 144 support_->SubmitCompositorFrame(root_id_, std::move(frame)); | 149 support_->SubmitCompositorFrame(root_id_, std::move(frame)); |
| 145 | 150 |
| 146 display_->Resize(viewport); | 151 display_->Resize(viewport); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 158 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { | 163 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { |
| 159 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); | 164 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); |
| 160 DCHECK(itr != child_ids_.end()); | 165 DCHECK(itr != child_ids_.end()); |
| 161 child_ids_.erase(itr); | 166 child_ids_.erase(itr); |
| 162 if (root_id_.is_valid()) | 167 if (root_id_.is_valid()) |
| 163 SetEmptyRootFrame(); | 168 SetEmptyRootFrame(); |
| 164 } | 169 } |
| 165 | 170 |
| 166 void SurfacesInstance::SetEmptyRootFrame() { | 171 void SurfacesInstance::SetEmptyRootFrame() { |
| 167 cc::CompositorFrame empty_frame; | 172 cc::CompositorFrame empty_frame; |
| 173 // We draw synchronously, so acknowledge a manual BeginFrame. |
| 174 empty_frame.metadata.begin_frame_ack = |
| 175 cc::BeginFrameAck(cc::BeginFrameArgs::kManualSourceId, |
| 176 cc::BeginFrameArgs::kStartingFrameNumber, |
| 177 cc::BeginFrameArgs::kStartingFrameNumber, 0, true); |
| 168 empty_frame.metadata.referenced_surfaces = child_ids_; | 178 empty_frame.metadata.referenced_surfaces = child_ids_; |
| 169 support_->SubmitCompositorFrame(root_id_, std::move(empty_frame)); | 179 support_->SubmitCompositorFrame(root_id_, std::move(empty_frame)); |
| 170 } | 180 } |
| 171 | 181 |
| 172 void SurfacesInstance::DidReceiveCompositorFrameAck() {} | 182 void SurfacesInstance::DidReceiveCompositorFrameAck() {} |
| 173 | 183 |
| 174 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} | 184 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} |
| 175 | 185 |
| 176 void SurfacesInstance::WillDrawSurface( | 186 void SurfacesInstance::WillDrawSurface( |
| 177 const cc::LocalSurfaceId& local_surface_id, | 187 const cc::LocalSurfaceId& local_surface_id, |
| 178 const gfx::Rect& damage_rect) {} | 188 const gfx::Rect& damage_rect) {} |
| 179 | 189 |
| 180 void SurfacesInstance::ReclaimResources( | 190 void SurfacesInstance::ReclaimResources( |
| 181 const cc::ReturnedResourceArray& resources) { | 191 const cc::ReturnedResourceArray& resources) { |
| 182 // Root surface should have no resources to return. | 192 // Root surface should have no resources to return. |
| 183 CHECK(resources.empty()); | 193 CHECK(resources.empty()); |
| 184 } | 194 } |
| 185 | 195 |
| 186 } // namespace android_webview | 196 } // namespace android_webview |
| OLD | NEW |