OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" | 5 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 std::move(overlay_candidate_validator)), | 40 std::move(overlay_candidate_validator)), |
41 weak_ptr_factory_(this) { | 41 weak_ptr_factory_(this) { |
42 capabilities_.uses_default_gl_framebuffer = false; | 42 capabilities_.uses_default_gl_framebuffer = false; |
43 } | 43 } |
44 | 44 |
45 OffscreenBrowserCompositorOutputSurface:: | 45 OffscreenBrowserCompositorOutputSurface:: |
46 ~OffscreenBrowserCompositorOutputSurface() { | 46 ~OffscreenBrowserCompositorOutputSurface() { |
47 DiscardBackbuffer(); | 47 DiscardBackbuffer(); |
48 } | 48 } |
49 | 49 |
| 50 void OffscreenBrowserCompositorOutputSurface::BindToClient( |
| 51 cc::OutputSurfaceClient* client) { |
| 52 DCHECK(client); |
| 53 DCHECK(!client_); |
| 54 client_ = client; |
| 55 } |
| 56 |
50 void OffscreenBrowserCompositorOutputSurface::EnsureBackbuffer() { | 57 void OffscreenBrowserCompositorOutputSurface::EnsureBackbuffer() { |
51 bool update_source_texture = !reflector_texture_ || reflector_changed_; | 58 bool update_source_texture = !reflector_texture_ || reflector_changed_; |
52 reflector_changed_ = false; | 59 reflector_changed_ = false; |
53 if (!reflector_texture_) { | 60 if (!reflector_texture_) { |
54 reflector_texture_.reset(new ReflectorTexture(context_provider())); | 61 reflector_texture_.reset(new ReflectorTexture(context_provider())); |
55 | 62 |
56 GLES2Interface* gl = context_provider_->ContextGL(); | 63 GLES2Interface* gl = context_provider_->ContextGL(); |
57 | 64 |
58 const int max_texture_size = | 65 const int max_texture_size = |
59 context_provider_->ContextCapabilities().max_texture_size; | 66 context_provider_->ContextCapabilities().max_texture_size; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 reflector_changed_ = true; | 185 reflector_changed_ = true; |
179 EnsureBackbuffer(); | 186 EnsureBackbuffer(); |
180 } | 187 } |
181 } | 188 } |
182 | 189 |
183 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete() { | 190 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
184 client_->DidReceiveSwapBuffersAck(); | 191 client_->DidReceiveSwapBuffersAck(); |
185 } | 192 } |
186 | 193 |
187 } // namespace content | 194 } // namespace content |
OLD | NEW |