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