| 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::CreateManualAckWithDamage(); |
| 137 frame.render_pass_list.push_back(std::move(render_pass)); | 140 frame.render_pass_list.push_back(std::move(render_pass)); |
| 138 frame.metadata.referenced_surfaces = child_ids_; | 141 frame.metadata.referenced_surfaces = child_ids_; |
| 139 | 142 |
| 140 if (!root_id_.is_valid()) { | 143 if (!root_id_.is_valid()) { |
| 141 root_id_ = local_surface_id_allocator_->GenerateId(); | 144 root_id_ = local_surface_id_allocator_->GenerateId(); |
| 142 display_->SetLocalSurfaceId(root_id_, 1.f); | 145 display_->SetLocalSurfaceId(root_id_, 1.f); |
| 143 } | 146 } |
| 144 support_->SubmitCompositorFrame(root_id_, std::move(frame)); | 147 support_->SubmitCompositorFrame(root_id_, std::move(frame)); |
| 145 | 148 |
| 146 display_->Resize(viewport); | 149 display_->Resize(viewport); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 158 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { | 161 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { |
| 159 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); | 162 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); |
| 160 DCHECK(itr != child_ids_.end()); | 163 DCHECK(itr != child_ids_.end()); |
| 161 child_ids_.erase(itr); | 164 child_ids_.erase(itr); |
| 162 if (root_id_.is_valid()) | 165 if (root_id_.is_valid()) |
| 163 SetEmptyRootFrame(); | 166 SetEmptyRootFrame(); |
| 164 } | 167 } |
| 165 | 168 |
| 166 void SurfacesInstance::SetEmptyRootFrame() { | 169 void SurfacesInstance::SetEmptyRootFrame() { |
| 167 cc::CompositorFrame empty_frame; | 170 cc::CompositorFrame empty_frame; |
| 171 // We draw synchronously, so acknowledge a manual BeginFrame. |
| 172 empty_frame.metadata.begin_frame_ack = |
| 173 cc::BeginFrameAck::CreateManualAckWithDamage(); |
| 168 empty_frame.metadata.referenced_surfaces = child_ids_; | 174 empty_frame.metadata.referenced_surfaces = child_ids_; |
| 169 support_->SubmitCompositorFrame(root_id_, std::move(empty_frame)); | 175 support_->SubmitCompositorFrame(root_id_, std::move(empty_frame)); |
| 170 } | 176 } |
| 171 | 177 |
| 172 void SurfacesInstance::DidReceiveCompositorFrameAck() {} | 178 void SurfacesInstance::DidReceiveCompositorFrameAck() {} |
| 173 | 179 |
| 174 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} | 180 void SurfacesInstance::OnBeginFrame(const cc::BeginFrameArgs& args) {} |
| 175 | 181 |
| 176 void SurfacesInstance::WillDrawSurface( | 182 void SurfacesInstance::WillDrawSurface( |
| 177 const cc::LocalSurfaceId& local_surface_id, | 183 const cc::LocalSurfaceId& local_surface_id, |
| 178 const gfx::Rect& damage_rect) {} | 184 const gfx::Rect& damage_rect) {} |
| 179 | 185 |
| 180 void SurfacesInstance::ReclaimResources( | 186 void SurfacesInstance::ReclaimResources( |
| 181 const cc::ReturnedResourceArray& resources) { | 187 const cc::ReturnedResourceArray& resources) { |
| 182 // Root surface should have no resources to return. | 188 // Root surface should have no resources to return. |
| 183 CHECK(resources.empty()); | 189 CHECK(resources.empty()); |
| 184 } | 190 } |
| 185 | 191 |
| 186 } // namespace android_webview | 192 } // namespace android_webview |
| OLD | NEW |