| 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 14 matching lines...) Expand all Loading... |
| 25 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
| 26 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
| 27 | 27 |
| 28 namespace android_webview { | 28 namespace android_webview { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 SurfacesInstance* g_surfaces_instance = nullptr; | 31 SurfacesInstance* g_surfaces_instance = nullptr; |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 scoped_refptr<SurfacesInstance> SurfacesInstance::GetOrCreateInstance() { | 35 scoped_refptr<SurfacesInstance> SurfacesInstance::GetOrCreateInstance( |
| 36 if (g_surfaces_instance) | 36 int framebuffer_binding_ext) { |
| 37 if (g_surfaces_instance) { |
| 38 g_surfaces_instance->SetBackingFrameBufferObject(framebuffer_binding_ext); |
| 37 return make_scoped_refptr(g_surfaces_instance); | 39 return make_scoped_refptr(g_surfaces_instance); |
| 38 return make_scoped_refptr(new SurfacesInstance); | 40 } |
| 41 return make_scoped_refptr(new SurfacesInstance(framebuffer_binding_ext)); |
| 39 } | 42 } |
| 40 | 43 |
| 41 SurfacesInstance::SurfacesInstance() | 44 SurfacesInstance::SurfacesInstance(int framebuffer_binding_ext) |
| 42 : next_surface_id_namespace_(1u), | 45 : next_surface_id_namespace_(1u), |
| 43 gl_surface_(new AwGLSurface) { | 46 gl_surface_(new AwGLSurface) { |
| 47 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); |
| 44 cc::RendererSettings settings; | 48 cc::RendererSettings settings; |
| 45 | 49 |
| 46 // Should be kept in sync with compositor_impl_android.cc. | 50 // Should be kept in sync with compositor_impl_android.cc. |
| 47 settings.allow_antialiasing = false; | 51 settings.allow_antialiasing = false; |
| 48 settings.highp_threshold_min = 2048; | 52 settings.highp_threshold_min = 2048; |
| 49 | 53 |
| 50 // Webview does not own the surface so should not clear it. | 54 // Webview does not own the surface so should not clear it. |
| 51 settings.should_clear_root_render_pass = false; | 55 settings.should_clear_root_render_pass = false; |
| 52 | 56 |
| 53 surface_manager_.reset(new cc::SurfaceManager); | 57 surface_manager_.reset(new cc::SurfaceManager); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 CHECK(resources.empty()); | 190 CHECK(resources.empty()); |
| 187 } | 191 } |
| 188 | 192 |
| 189 void SurfacesInstance::SetBeginFrameSource( | 193 void SurfacesInstance::SetBeginFrameSource( |
| 190 cc::BeginFrameSource* begin_frame_source) { | 194 cc::BeginFrameSource* begin_frame_source) { |
| 191 // Parent compsitor calls DrawAndSwap directly and doesn't use | 195 // Parent compsitor calls DrawAndSwap directly and doesn't use |
| 192 // BeginFrameSource. | 196 // BeginFrameSource. |
| 193 } | 197 } |
| 194 | 198 |
| 195 } // namespace android_webview | 199 } // namespace android_webview |
| OLD | NEW |