| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 cc::RendererSettings settings; | 43 cc::RendererSettings settings; |
| 44 | 44 |
| 45 // Should be kept in sync with compositor_impl_android.cc. | 45 // Should be kept in sync with compositor_impl_android.cc. |
| 46 settings.allow_antialiasing = false; | 46 settings.allow_antialiasing = false; |
| 47 settings.highp_threshold_min = 2048; | 47 settings.highp_threshold_min = 2048; |
| 48 | 48 |
| 49 // Webview does not own the surface so should not clear it. | 49 // Webview does not own the surface so should not clear it. |
| 50 settings.should_clear_root_render_pass = false; | 50 settings.should_clear_root_render_pass = false; |
| 51 | 51 |
| 52 surface_manager_.reset(new cc::SurfaceManager); | 52 surface_manager_.reset(new cc::SurfaceManager); |
| 53 surface_id_allocator_.reset(new cc::SurfaceIdAllocator(frame_sink_id_)); | 53 surface_id_allocator_.reset(new cc::SurfaceIdAllocator()); |
| 54 surface_manager_->RegisterFrameSinkId(frame_sink_id_); | 54 surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| 55 | 55 |
| 56 std::unique_ptr<cc::BeginFrameSource> begin_frame_source( | 56 std::unique_ptr<cc::BeginFrameSource> begin_frame_source( |
| 57 new cc::StubBeginFrameSource); | 57 new cc::StubBeginFrameSource); |
| 58 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter( | 58 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter( |
| 59 new cc::TextureMailboxDeleter(nullptr)); | 59 new cc::TextureMailboxDeleter(nullptr)); |
| 60 std::unique_ptr<ParentOutputSurface> output_surface_holder( | 60 std::unique_ptr<ParentOutputSurface> output_surface_holder( |
| 61 new ParentOutputSurface(AwRenderThreadContextProvider::Create( | 61 new ParentOutputSurface(AwRenderThreadContextProvider::Create( |
| 62 make_scoped_refptr(new AwGLSurface), | 62 make_scoped_refptr(new AwGLSurface), |
| 63 DeferredGpuCommandService::GetInstance()))); | 63 DeferredGpuCommandService::GetInstance()))); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 std::unique_ptr<cc::DelegatedFrameData> delegated_frame( | 129 std::unique_ptr<cc::DelegatedFrameData> delegated_frame( |
| 130 new cc::DelegatedFrameData); | 130 new cc::DelegatedFrameData); |
| 131 delegated_frame->render_pass_list.push_back(std::move(render_pass)); | 131 delegated_frame->render_pass_list.push_back(std::move(render_pass)); |
| 132 cc::CompositorFrame frame; | 132 cc::CompositorFrame frame; |
| 133 frame.delegated_frame_data = std::move(delegated_frame); | 133 frame.delegated_frame_data = std::move(delegated_frame); |
| 134 frame.metadata.referenced_surfaces = child_ids_; | 134 frame.metadata.referenced_surfaces = child_ids_; |
| 135 | 135 |
| 136 if (root_id_.is_null()) { | 136 if (root_id_.is_null()) { |
| 137 root_id_ = surface_id_allocator_->GenerateId(); | 137 root_id_ = surface_id_allocator_->GenerateId(); |
| 138 surface_factory_->Create(root_id_); | 138 surface_factory_->Create(root_id_); |
| 139 display_->SetSurfaceId(root_id_, 1.f); | 139 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, root_id_), 1.f); |
| 140 } | 140 } |
| 141 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), | 141 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), |
| 142 cc::SurfaceFactory::DrawCallback()); | 142 cc::SurfaceFactory::DrawCallback()); |
| 143 | 143 |
| 144 display_->Resize(viewport); | 144 display_->Resize(viewport); |
| 145 display_->DrawAndSwap(); | 145 display_->DrawAndSwap(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) { | 148 void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) { |
| 149 DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) == | 149 DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) == |
| (...skipping 26 matching lines...) Expand all Loading... |
| 176 CHECK(resources.empty()); | 176 CHECK(resources.empty()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void SurfacesInstance::SetBeginFrameSource( | 179 void SurfacesInstance::SetBeginFrameSource( |
| 180 cc::BeginFrameSource* begin_frame_source) { | 180 cc::BeginFrameSource* begin_frame_source) { |
| 181 // Parent compsitor calls DrawAndSwap directly and doesn't use | 181 // Parent compsitor calls DrawAndSwap directly and doesn't use |
| 182 // BeginFrameSource. | 182 // BeginFrameSource. |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace android_webview | 185 } // namespace android_webview |
| OLD | NEW |