Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 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 if (g_surfaces_instance) |
| 37 return make_scoped_refptr(g_surfaces_instance); | 37 return make_scoped_refptr(g_surfaces_instance); |
| 38 return make_scoped_refptr(new SurfacesInstance); | 38 return make_scoped_refptr(new SurfacesInstance); |
| 39 } | 39 } |
| 40 | 40 |
| 41 SurfacesInstance::SurfacesInstance() | 41 SurfacesInstance::SurfacesInstance() : frame_sink_id_(AllocateFrameSinkId()) { |
| 42 : next_client_id_(1u), frame_sink_id_(AllocateFrameSinkId()) { | |
| 43 cc::RendererSettings settings; | 42 cc::RendererSettings settings; |
| 44 | 43 |
| 45 // Should be kept in sync with compositor_impl_android.cc. | 44 // Should be kept in sync with compositor_impl_android.cc. |
| 46 settings.allow_antialiasing = false; | 45 settings.allow_antialiasing = false; |
| 47 settings.highp_threshold_min = 2048; | 46 settings.highp_threshold_min = 2048; |
| 48 | 47 |
| 49 // Webview does not own the surface so should not clear it. | 48 // Webview does not own the surface so should not clear it. |
| 50 settings.should_clear_root_render_pass = false; | 49 settings.should_clear_root_render_pass = false; |
| 51 | 50 |
| 52 surface_manager_.reset(new cc::SurfaceManager); | 51 surface_manager_.reset(new cc::SurfaceManager); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 82 g_surfaces_instance = nullptr; | 81 g_surfaces_instance = nullptr; |
| 83 DCHECK(child_ids_.empty()); | 82 DCHECK(child_ids_.empty()); |
| 84 } | 83 } |
| 85 | 84 |
| 86 void SurfacesInstance::DisplayOutputSurfaceLost() { | 85 void SurfacesInstance::DisplayOutputSurfaceLost() { |
| 87 // Android WebView does not handle context loss. | 86 // Android WebView does not handle context loss. |
| 88 LOG(FATAL) << "Render thread context loss"; | 87 LOG(FATAL) << "Render thread context loss"; |
| 89 } | 88 } |
| 90 | 89 |
| 91 cc::FrameSinkId SurfacesInstance::AllocateFrameSinkId() { | 90 cc::FrameSinkId SurfacesInstance::AllocateFrameSinkId() { |
| 92 return cc::FrameSinkId(next_client_id_++, 0 /* sink_id */); | 91 return frame_sink_id_allocator_.NextFrameSinkId(); |
|
xlai (Olivia)
2017/02/15 18:05:46
This particular change will change the behavior to
Fady Samuel
2017/02/15 20:20:59
Thanks for catching this, Olivia! :D
| |
| 93 } | 92 } |
| 94 | 93 |
| 95 cc::SurfaceManager* SurfacesInstance::GetSurfaceManager() { | 94 cc::SurfaceManager* SurfacesInstance::GetSurfaceManager() { |
| 96 return surface_manager_.get(); | 95 return surface_manager_.get(); |
| 97 } | 96 } |
| 98 | 97 |
| 99 void SurfacesInstance::DrawAndSwap(const gfx::Size& viewport, | 98 void SurfacesInstance::DrawAndSwap(const gfx::Size& viewport, |
| 100 const gfx::Rect& clip, | 99 const gfx::Rect& clip, |
| 101 const gfx::Transform& transform, | 100 const gfx::Transform& transform, |
| 102 const gfx::Size& frame_size, | 101 const gfx::Size& frame_size, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 | 165 |
| 167 void SurfacesInstance::WillDrawSurface() {} | 166 void SurfacesInstance::WillDrawSurface() {} |
| 168 | 167 |
| 169 void SurfacesInstance::ReclaimResources( | 168 void SurfacesInstance::ReclaimResources( |
| 170 const cc::ReturnedResourceArray& resources) { | 169 const cc::ReturnedResourceArray& resources) { |
| 171 // Root surface should have no resources to return. | 170 // Root surface should have no resources to return. |
| 172 CHECK(resources.empty()); | 171 CHECK(resources.empty()); |
| 173 } | 172 } |
| 174 | 173 |
| 175 } // namespace android_webview | 174 } // namespace android_webview |
| OLD | NEW |