| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 quad_state->visible_quad_layer_rect = gfx::Rect(frame_size); | 126 quad_state->visible_quad_layer_rect = gfx::Rect(frame_size); |
| 127 quad_state->clip_rect = clip; | 127 quad_state->clip_rect = clip; |
| 128 quad_state->is_clipped = true; | 128 quad_state->is_clipped = true; |
| 129 quad_state->opacity = 1.f; | 129 quad_state->opacity = 1.f; |
| 130 | 130 |
| 131 cc::SurfaceDrawQuad* surface_quad = | 131 cc::SurfaceDrawQuad* surface_quad = |
| 132 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); | 132 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
| 133 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), | 133 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), |
| 134 gfx::Rect(quad_state->quad_layer_bounds), child_id); | 134 gfx::Rect(quad_state->quad_layer_bounds), child_id); |
| 135 | 135 |
| 136 std::unique_ptr<cc::DelegatedFrameData> delegated_frame( | |
| 137 new cc::DelegatedFrameData); | |
| 138 delegated_frame->render_pass_list.push_back(std::move(render_pass)); | |
| 139 cc::CompositorFrame frame; | 136 cc::CompositorFrame frame; |
| 140 frame.delegated_frame_data = std::move(delegated_frame); | 137 frame.render_pass_list.push_back(std::move(render_pass)); |
| 141 frame.metadata.referenced_surfaces = child_ids_; | 138 frame.metadata.referenced_surfaces = child_ids_; |
| 142 | 139 |
| 143 if (root_id_.is_null()) { | 140 if (root_id_.is_null()) { |
| 144 root_id_ = surface_id_allocator_->GenerateId(); | 141 root_id_ = surface_id_allocator_->GenerateId(); |
| 145 surface_factory_->Create(root_id_); | 142 surface_factory_->Create(root_id_); |
| 146 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, root_id_), 1.f); | 143 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, root_id_), 1.f); |
| 147 } | 144 } |
| 148 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), | 145 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), |
| 149 cc::SurfaceFactory::DrawCallback()); | 146 cc::SurfaceFactory::DrawCallback()); |
| 150 | 147 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 163 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { | 160 void SurfacesInstance::RemoveChildId(const cc::SurfaceId& child_id) { |
| 164 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); | 161 auto itr = std::find(child_ids_.begin(), child_ids_.end(), child_id); |
| 165 DCHECK(itr != child_ids_.end()); | 162 DCHECK(itr != child_ids_.end()); |
| 166 child_ids_.erase(itr); | 163 child_ids_.erase(itr); |
| 167 if (!root_id_.is_null()) | 164 if (!root_id_.is_null()) |
| 168 SetEmptyRootFrame(); | 165 SetEmptyRootFrame(); |
| 169 } | 166 } |
| 170 | 167 |
| 171 void SurfacesInstance::SetEmptyRootFrame() { | 168 void SurfacesInstance::SetEmptyRootFrame() { |
| 172 cc::CompositorFrame empty_frame; | 169 cc::CompositorFrame empty_frame; |
| 173 empty_frame.delegated_frame_data = | |
| 174 base::WrapUnique(new cc::DelegatedFrameData); | |
| 175 empty_frame.metadata.referenced_surfaces = child_ids_; | 170 empty_frame.metadata.referenced_surfaces = child_ids_; |
| 176 surface_factory_->SubmitCompositorFrame(root_id_, std::move(empty_frame), | 171 surface_factory_->SubmitCompositorFrame(root_id_, std::move(empty_frame), |
| 177 cc::SurfaceFactory::DrawCallback()); | 172 cc::SurfaceFactory::DrawCallback()); |
| 178 } | 173 } |
| 179 | 174 |
| 180 void SurfacesInstance::ReturnResources( | 175 void SurfacesInstance::ReturnResources( |
| 181 const cc::ReturnedResourceArray& resources) { | 176 const cc::ReturnedResourceArray& resources) { |
| 182 // Root surface should have no resources to return. | 177 // Root surface should have no resources to return. |
| 183 CHECK(resources.empty()); | 178 CHECK(resources.empty()); |
| 184 } | 179 } |
| 185 | 180 |
| 186 void SurfacesInstance::SetBeginFrameSource( | 181 void SurfacesInstance::SetBeginFrameSource( |
| 187 cc::BeginFrameSource* begin_frame_source) { | 182 cc::BeginFrameSource* begin_frame_source) { |
| 188 // Parent compsitor calls DrawAndSwap directly and doesn't use | 183 // Parent compsitor calls DrawAndSwap directly and doesn't use |
| 189 // BeginFrameSource. | 184 // BeginFrameSource. |
| 190 } | 185 } |
| 191 | 186 |
| 192 } // namespace android_webview | 187 } // namespace android_webview |
| OLD | NEW |