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