| OLD | NEW |
| 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/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
| 10 #include "android_webview/browser/aw_render_thread_context_provider.h" | 10 #include "android_webview/browser/aw_render_thread_context_provider.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 shared_renderer_state_->PassCompositorFrameOnRT(); | 80 shared_renderer_state_->PassCompositorFrameOnRT(); |
| 81 if (!child_frame.get()) | 81 if (!child_frame.get()) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 ReturnResourcesInChildFrame(); | 84 ReturnResourcesInChildFrame(); |
| 85 child_frame_ = std::move(child_frame); | 85 child_frame_ = std::move(child_frame); |
| 86 DCHECK(child_frame_->frame.get()); | 86 DCHECK(child_frame_->frame.get()); |
| 87 DCHECK(!child_frame_->frame->gl_frame_data); | 87 DCHECK(!child_frame_->frame->gl_frame_data); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void HardwareRenderer::DrawGL(bool stencil_enabled, | 90 void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info, |
| 91 AwDrawGLInfo* draw_info) { | 91 const ScopedAppGLStateRestore& gl_state) { |
| 92 TRACE_EVENT0("android_webview", "HardwareRenderer::DrawGL"); | 92 TRACE_EVENT0("android_webview", "HardwareRenderer::DrawGL"); |
| 93 | 93 |
| 94 // We need to watch if the current Android context has changed and enforce | 94 // We need to watch if the current Android context has changed and enforce |
| 95 // a clean-up in the compositor. | 95 // a clean-up in the compositor. |
| 96 EGLContext current_context = eglGetCurrentContext(); | 96 EGLContext current_context = eglGetCurrentContext(); |
| 97 DCHECK(current_context) << "DrawGL called without EGLContext"; | 97 DCHECK(current_context) << "DrawGL called without EGLContext"; |
| 98 | 98 |
| 99 // TODO(boliu): Handle context loss. | 99 // TODO(boliu): Handle context loss. |
| 100 if (last_egl_context_ != current_context) | 100 if (last_egl_context_ != current_context) |
| 101 DLOG(WARNING) << "EGLContextChanged"; | 101 DLOG(WARNING) << "EGLContextChanged"; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 if (!output_surface_) { | 205 if (!output_surface_) { |
| 206 scoped_refptr<cc::ContextProvider> context_provider = | 206 scoped_refptr<cc::ContextProvider> context_provider = |
| 207 AwRenderThreadContextProvider::Create( | 207 AwRenderThreadContextProvider::Create( |
| 208 gl_surface_, DeferredGpuCommandService::GetInstance()); | 208 gl_surface_, DeferredGpuCommandService::GetInstance()); |
| 209 scoped_ptr<ParentOutputSurface> output_surface_holder( | 209 scoped_ptr<ParentOutputSurface> output_surface_holder( |
| 210 new ParentOutputSurface(context_provider)); | 210 new ParentOutputSurface(context_provider)); |
| 211 output_surface_ = output_surface_holder.get(); | 211 output_surface_ = output_surface_holder.get(); |
| 212 display_->Initialize(std::move(output_surface_holder), nullptr); | 212 display_->Initialize(std::move(output_surface_holder), nullptr); |
| 213 } | 213 } |
| 214 output_surface_->SetExternalStencilTest(stencil_enabled); | 214 output_surface_->SetGLState(gl_state); |
| 215 display_->SetExternalClip(clip); | 215 display_->SetExternalClip(clip); |
| 216 display_->DrawAndSwap(); | 216 display_->DrawAndSwap(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void HardwareRenderer::ReturnResources( | 219 void HardwareRenderer::ReturnResources( |
| 220 const cc::ReturnedResourceArray& resources) { | 220 const cc::ReturnedResourceArray& resources) { |
| 221 ReturnResourcesToCompositor(resources, compositor_id_); | 221 ReturnResourcesToCompositor(resources, compositor_id_); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void HardwareRenderer::SetBeginFrameSource( | 224 void HardwareRenderer::SetBeginFrameSource( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 247 child_frame_.reset(); | 247 child_frame_.reset(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void HardwareRenderer::ReturnResourcesToCompositor( | 250 void HardwareRenderer::ReturnResourcesToCompositor( |
| 251 const cc::ReturnedResourceArray& resources, | 251 const cc::ReturnedResourceArray& resources, |
| 252 unsigned int compositor_id) { | 252 unsigned int compositor_id) { |
| 253 shared_renderer_state_->InsertReturnedResourcesOnRT(resources, compositor_id); | 253 shared_renderer_state_->InsertReturnedResourcesOnRT(resources, compositor_id); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace android_webview | 256 } // namespace android_webview |
| OLD | NEW |