Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: android_webview/browser/parent_output_surface.cc

Issue 2352963002: cc: Make most of cc::OutputSurface abstract. (Closed)
Patch Set: outputsurface-cleanup: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/parent_output_surface.h" 5 #include "android_webview/browser/parent_output_surface.h"
6 6
7 #include "android_webview/browser/aw_render_thread_context_provider.h" 7 #include "android_webview/browser/aw_render_thread_context_provider.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
10 #include "gpu/command_buffer/client/gles2_interface.h" 10 #include "gpu/command_buffer/client/gles2_interface.h"
11 11
12 namespace android_webview { 12 namespace android_webview {
13 13
14 ParentOutputSurface::ParentOutputSurface( 14 ParentOutputSurface::ParentOutputSurface(
15 scoped_refptr<AwRenderThreadContextProvider> context_provider) 15 scoped_refptr<AwRenderThreadContextProvider> context_provider)
16 : cc::OutputSurface(std::move(context_provider)) { 16 : cc::OutputSurface(std::move(context_provider)) {
17 stencil_state_.stencil_test_enabled = false; 17 stencil_state_.stencil_test_enabled = false;
18 } 18 }
19 19
20 ParentOutputSurface::~ParentOutputSurface() { 20 ParentOutputSurface::~ParentOutputSurface() {
21 } 21 }
22 22
23 void ParentOutputSurface::DidLoseOutputSurface() { 23 void ParentOutputSurface::DidLoseOutputSurface() {
24 // Android WebView does not handle context loss. 24 // Android WebView does not handle context loss.
25 LOG(FATAL) << "Render thread context loss"; 25 LOG(FATAL) << "Render thread context loss";
26 } 26 }
27 27
28 void ParentOutputSurface::EnsureBackbuffer() {}
29
30 void ParentOutputSurface::DiscardBackbuffer() {
31 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
32 }
33
34 void ParentOutputSurface::BindFramebuffer() {
35 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
36 }
37
28 void ParentOutputSurface::Reshape(const gfx::Size& size, 38 void ParentOutputSurface::Reshape(const gfx::Size& size,
29 float scale_factor, 39 float scale_factor,
30 const gfx::ColorSpace& color_space, 40 const gfx::ColorSpace& color_space,
31 bool has_alpha) { 41 bool has_alpha) {
32 DCHECK_EQ(1.f, scale_factor); 42 DCHECK_EQ(1.f, scale_factor);
33 surface_size_ = size; 43 surface_size_ = size;
34 } 44 }
35 45
36 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) { 46 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
37 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); 47 context_provider_->ContextGL()->ShallowFlushCHROMIUM();
(...skipping 20 matching lines...) Expand all
58 gl->StencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op, 68 gl->StencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op,
59 stencil_state_.stencil_back_z_fail_op, 69 stencil_state_.stencil_back_z_fail_op,
60 stencil_state_.stencil_back_z_pass_op); 70 stencil_state_.stencil_back_z_pass_op);
61 } 71 }
62 72
63 uint32_t ParentOutputSurface::GetFramebufferCopyTextureFormat() { 73 uint32_t ParentOutputSurface::GetFramebufferCopyTextureFormat() {
64 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider()); 74 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider());
65 return gl->GetCopyTextureInternalFormat(); 75 return gl->GetCopyTextureInternalFormat();
66 } 76 }
67 77
78 cc::OverlayCandidateValidator*
79 ParentOutputSurface::GetOverlayCandidateValidator() const {
80 return nullptr;
81 }
82
83 bool ParentOutputSurface::IsDisplayedAsOverlayPlane() const {
84 return false;
85 }
86
87 unsigned ParentOutputSurface::GetOverlayTextureId() const {
88 return 0;
89 }
90
91 bool ParentOutputSurface::SurfaceIsSuspendForRecycle() const {
92 return false;
93 }
94
68 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) { 95 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) {
69 stencil_state_ = gl_state.stencil_state(); 96 stencil_state_ = gl_state.stencil_state();
70 } 97 }
71 98
72 } // namespace android_webview 99 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698