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

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

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nits Created 4 years, 5 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/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
9 #include "gpu/command_buffer/client/gles2_interface.h" 10 #include "gpu/command_buffer/client/gles2_interface.h"
10 11
11 namespace android_webview { 12 namespace android_webview {
12 13
13 ParentOutputSurface::ParentOutputSurface( 14 ParentOutputSurface::ParentOutputSurface(
14 scoped_refptr<AwRenderThreadContextProvider> context_provider) 15 scoped_refptr<AwRenderThreadContextProvider> context_provider)
15 : cc::OutputSurface(std::move(context_provider), nullptr, nullptr) { 16 : cc::OutputSurface(std::move(context_provider), nullptr, nullptr) {
16 stencil_state_.stencil_test_enabled = false; 17 stencil_state_.stencil_test_enabled = false;
17 } 18 }
18 19
19 ParentOutputSurface::~ParentOutputSurface() { 20 ParentOutputSurface::~ParentOutputSurface() {
20 } 21 }
21 22
22 void ParentOutputSurface::DidLoseOutputSurface() { 23 void ParentOutputSurface::DidLoseOutputSurface() {
23 // Android WebView does not handle context loss. 24 // Android WebView does not handle context loss.
24 LOG(FATAL) << "Render thread context loss"; 25 LOG(FATAL) << "Render thread context loss";
25 } 26 }
26 27
27 void ParentOutputSurface::Reshape(const gfx::Size& size, 28 void ParentOutputSurface::Reshape(const gfx::Size& size,
28 float scale_factor, 29 float scale_factor,
29 bool has_alpha) { 30 bool has_alpha) {
30 DCHECK_EQ(1.f, scale_factor); 31 DCHECK_EQ(1.f, scale_factor);
31 surface_size_ = size; 32 surface_size_ = size;
32 } 33 }
33 34
34 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { 35 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
35 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); 36 context_provider_->ContextGL()->ShallowFlushCHROMIUM();
36 client_->DidSwapBuffers(); 37 client_->DidSwapBuffers();
37 } 38 }
38 39
39 void ParentOutputSurface::ApplyExternalStencil() { 40 void ParentOutputSurface::ApplyExternalStencil() {
40 DCHECK(stencil_state_.stencil_test_enabled); 41 DCHECK(stencil_state_.stencil_test_enabled);
41 gpu::gles2::GLES2Interface* gl = context_provider()->ContextGL(); 42 gpu::gles2::GLES2Interface* gl = context_provider()->ContextGL();
42 gl->StencilFuncSeparate(GL_FRONT, stencil_state_.stencil_front_func, 43 gl->StencilFuncSeparate(GL_FRONT, stencil_state_.stencil_front_func,
43 stencil_state_.stencil_front_mask, 44 stencil_state_.stencil_front_mask,
44 stencil_state_.stencil_front_ref); 45 stencil_state_.stencil_front_ref);
(...skipping 14 matching lines...) Expand all
59 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider()); 60 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider());
60 return gl->GetCopyTextureInternalFormat(); 61 return gl->GetCopyTextureInternalFormat();
61 } 62 }
62 63
63 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) { 64 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) {
64 stencil_state_ = gl_state.stencil_state(); 65 stencil_state_ = gl_state.stencil_state();
65 SetExternalStencilTest(stencil_state_.stencil_test_enabled); 66 SetExternalStencilTest(stencil_state_.stencil_test_enabled);
66 } 67 }
67 68
68 } // namespace android_webview 69 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/parent_output_surface.h ('k') | blimp/client/feature/compositor/blimp_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698