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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()); | 53 surface_id_allocator_.reset(new cc::SurfaceIdAllocator()); |
54 surface_manager_->RegisterFrameSinkId(frame_sink_id_); | 54 surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
55 surface_factory_.reset( | 55 surface_factory_.reset( |
56 new cc::SurfaceFactory(frame_sink_id_, surface_manager_.get(), this)); | 56 new cc::SurfaceFactory(frame_sink_id_, surface_manager_.get(), this)); |
57 | 57 |
58 std::unique_ptr<cc::BeginFrameSource> begin_frame_source( | 58 begin_frame_source_.reset(new cc::StubBeginFrameSource); |
59 new cc::StubBeginFrameSource); | |
60 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter( | 59 std::unique_ptr<cc::TextureMailboxDeleter> texture_mailbox_deleter( |
61 new cc::TextureMailboxDeleter(nullptr)); | 60 new cc::TextureMailboxDeleter(nullptr)); |
62 std::unique_ptr<ParentOutputSurface> output_surface_holder( | 61 std::unique_ptr<ParentOutputSurface> output_surface_holder( |
63 new ParentOutputSurface(AwRenderThreadContextProvider::Create( | 62 new ParentOutputSurface(AwRenderThreadContextProvider::Create( |
64 make_scoped_refptr(new AwGLSurface), | 63 make_scoped_refptr(new AwGLSurface), |
65 DeferredGpuCommandService::GetInstance()))); | 64 DeferredGpuCommandService::GetInstance()))); |
66 output_surface_ = output_surface_holder.get(); | 65 output_surface_ = output_surface_holder.get(); |
67 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 66 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
68 begin_frame_source.get(), nullptr, | 67 nullptr, output_surface_holder->capabilities().max_frames_pending)); |
69 output_surface_holder->capabilities().max_frames_pending)); | |
70 display_.reset(new cc::Display( | 68 display_.reset(new cc::Display( |
71 nullptr /* shared_bitmap_manager */, | 69 nullptr /* shared_bitmap_manager */, |
72 nullptr /* gpu_memory_buffer_manager */, settings, frame_sink_id_, | 70 nullptr /* gpu_memory_buffer_manager */, settings, frame_sink_id_, |
73 std::move(begin_frame_source), std::move(output_surface_holder), | 71 begin_frame_source_.get(), std::move(output_surface_holder), |
74 std::move(scheduler), std::move(texture_mailbox_deleter))); | 72 std::move(scheduler), std::move(texture_mailbox_deleter))); |
75 display_->Initialize(this, surface_manager_.get()); | 73 display_->Initialize(this, surface_manager_.get()); |
76 display_->SetVisible(true); | 74 display_->SetVisible(true); |
77 | 75 |
78 DCHECK(!g_surfaces_instance); | 76 DCHECK(!g_surfaces_instance); |
79 g_surfaces_instance = this; | 77 g_surfaces_instance = this; |
80 | 78 |
81 } | 79 } |
82 | 80 |
83 SurfacesInstance::~SurfacesInstance() { | 81 SurfacesInstance::~SurfacesInstance() { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 CHECK(resources.empty()); | 172 CHECK(resources.empty()); |
175 } | 173 } |
176 | 174 |
177 void SurfacesInstance::SetBeginFrameSource( | 175 void SurfacesInstance::SetBeginFrameSource( |
178 cc::BeginFrameSource* begin_frame_source) { | 176 cc::BeginFrameSource* begin_frame_source) { |
179 // Parent compsitor calls DrawAndSwap directly and doesn't use | 177 // Parent compsitor calls DrawAndSwap directly and doesn't use |
180 // BeginFrameSource. | 178 // BeginFrameSource. |
181 } | 179 } |
182 | 180 |
183 } // namespace android_webview | 181 } // namespace android_webview |
OLD | NEW |