| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 std::unique_ptr<ParentOutputSurface> output_surface_holder( | 62 std::unique_ptr<ParentOutputSurface> output_surface_holder( |
| 63 new ParentOutputSurface(AwRenderThreadContextProvider::Create( | 63 new ParentOutputSurface(AwRenderThreadContextProvider::Create( |
| 64 make_scoped_refptr(new AwGLSurface), | 64 make_scoped_refptr(new AwGLSurface), |
| 65 DeferredGpuCommandService::GetInstance()))); | 65 DeferredGpuCommandService::GetInstance()))); |
| 66 output_surface_ = output_surface_holder.get(); | 66 output_surface_ = output_surface_holder.get(); |
| 67 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 67 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
| 68 begin_frame_source.get(), nullptr, | 68 begin_frame_source.get(), nullptr, |
| 69 output_surface_holder->capabilities().max_frames_pending)); | 69 output_surface_holder->capabilities().max_frames_pending)); |
| 70 display_.reset(new cc::Display( | 70 display_.reset(new cc::Display( |
| 71 nullptr /* shared_bitmap_manager */, | 71 nullptr /* shared_bitmap_manager */, |
| 72 nullptr /* gpu_memory_buffer_manager */, settings, | 72 nullptr /* gpu_memory_buffer_manager */, settings, frame_sink_id_, |
| 73 std::move(begin_frame_source), std::move(output_surface_holder), | 73 std::move(begin_frame_source), std::move(output_surface_holder), |
| 74 std::move(scheduler), std::move(texture_mailbox_deleter))); | 74 std::move(scheduler), std::move(texture_mailbox_deleter))); |
| 75 display_->Initialize(this, surface_manager_.get(), frame_sink_id_); | 75 display_->Initialize(this, surface_manager_.get()); |
| 76 display_->SetVisible(true); | 76 display_->SetVisible(true); |
| 77 | 77 |
| 78 DCHECK(!g_surfaces_instance); | 78 DCHECK(!g_surfaces_instance); |
| 79 g_surfaces_instance = this; | 79 g_surfaces_instance = this; |
| 80 | 80 |
| 81 } | 81 } |
| 82 | 82 |
| 83 SurfacesInstance::~SurfacesInstance() { | 83 SurfacesInstance::~SurfacesInstance() { |
| 84 DCHECK_EQ(g_surfaces_instance, this); | 84 DCHECK_EQ(g_surfaces_instance, this); |
| 85 g_surfaces_instance = nullptr; | 85 g_surfaces_instance = nullptr; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 cc::CompositorFrame frame; | 135 cc::CompositorFrame frame; |
| 136 frame.render_pass_list.push_back(std::move(render_pass)); | 136 frame.render_pass_list.push_back(std::move(render_pass)); |
| 137 frame.metadata.referenced_surfaces = child_ids_; | 137 frame.metadata.referenced_surfaces = child_ids_; |
| 138 | 138 |
| 139 if (!root_id_.is_valid()) { | 139 if (!root_id_.is_valid()) { |
| 140 root_id_ = surface_id_allocator_->GenerateId(); | 140 root_id_ = surface_id_allocator_->GenerateId(); |
| 141 surface_factory_->Create(root_id_); | 141 surface_factory_->Create(root_id_); |
| 142 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, root_id_), 1.f); | 142 display_->SetLocalFrameId(root_id_, 1.f); |
| 143 } | 143 } |
| 144 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), | 144 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), |
| 145 cc::SurfaceFactory::DrawCallback()); | 145 cc::SurfaceFactory::DrawCallback()); |
| 146 | 146 |
| 147 display_->Resize(viewport); | 147 display_->Resize(viewport); |
| 148 display_->DrawAndSwap(); | 148 display_->DrawAndSwap(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) { | 151 void SurfacesInstance::AddChildId(const cc::SurfaceId& child_id) { |
| 152 DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) == | 152 DCHECK(std::find(child_ids_.begin(), child_ids_.end(), child_id) == |
| (...skipping 24 matching lines...) Expand all Loading... |
| 177 CHECK(resources.empty()); | 177 CHECK(resources.empty()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void SurfacesInstance::SetBeginFrameSource( | 180 void SurfacesInstance::SetBeginFrameSource( |
| 181 cc::BeginFrameSource* begin_frame_source) { | 181 cc::BeginFrameSource* begin_frame_source) { |
| 182 // Parent compsitor calls DrawAndSwap directly and doesn't use | 182 // Parent compsitor calls DrawAndSwap directly and doesn't use |
| 183 // BeginFrameSource. | 183 // BeginFrameSource. |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace android_webview | 186 } // namespace android_webview |
| OLD | NEW |