Chromium Code Reviews| 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 "android_webview/browser/aw_gl_surface.h" | 7 #include "android_webview/browser/aw_gl_surface.h" |
| 8 #include "android_webview/browser/deferred_gpu_command_service.h" | 8 #include "android_webview/browser/deferred_gpu_command_service.h" |
| 9 #include "android_webview/browser/parent_output_surface.h" | 9 #include "android_webview/browser/parent_output_surface.h" |
| 10 #include "android_webview/browser/shared_renderer_state.h" | 10 #include "android_webview/browser/shared_renderer_state.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 delegated_layer_->SetTransform(transform); | 200 delegated_layer_->SetTransform(transform); |
| 201 | 201 |
| 202 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); | 202 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); |
| 203 { | 203 { |
| 204 base::AutoReset<bool> frame_resetter(&viewport_clip_valid_for_dcheck_, | 204 base::AutoReset<bool> frame_resetter(&viewport_clip_valid_for_dcheck_, |
| 205 true); | 205 true); |
| 206 layer_tree_host_->SetNeedsRedrawRect(clip_); | 206 layer_tree_host_->SetNeedsRedrawRect(clip_); |
| 207 layer_tree_host_->Composite(gfx::FrameTime::Now()); | 207 layer_tree_host_->Composite(gfx::FrameTime::Now()); |
| 208 } | 208 } |
| 209 gl_surface_->ResetBackingFrameBufferObject(); | 209 gl_surface_->ResetBackingFrameBufferObject(); |
| 210 | |
| 211 // Need to post the new transform matrix back to child compositor | |
| 212 // because there is no onDraw during a Render Thread animation, and child | |
| 213 // compositor might not have the tiles rasterized as the animation goes on. | |
| 214 ParentCompositorDrawConstraints draw_constraints( | |
| 215 draw_info->is_layer, transform, gfx::Rect(viewport_)); | |
| 216 if (!draw_constraints_.equals(draw_constraints)) { | |
|
boliu
2014/07/29 19:02:41
Remember we are not looking for "equals" exactly.
hush (inactive)
2014/07/29 21:14:21
Yeah.
Why do we want to move this to the beginnin
| |
| 217 draw_constraints_ = draw_constraints; | |
| 218 shared_renderer_state_->PostExternalDrawConstraintsToChildCompositor( | |
| 219 draw_constraints); | |
| 220 } | |
| 210 } | 221 } |
| 211 | 222 |
| 212 scoped_ptr<cc::OutputSurface> HardwareRenderer::CreateOutputSurface( | 223 scoped_ptr<cc::OutputSurface> HardwareRenderer::CreateOutputSurface( |
| 213 bool fallback) { | 224 bool fallback) { |
| 214 // Android webview does not support losing output surface. | 225 // Android webview does not support losing output surface. |
| 215 DCHECK(!fallback); | 226 DCHECK(!fallback); |
| 216 scoped_refptr<cc::ContextProvider> context_provider = | 227 scoped_refptr<cc::ContextProvider> context_provider = |
| 217 CreateContext(gl_surface_, | 228 CreateContext(gl_surface_, |
| 218 DeferredGpuCommandService::GetInstance(), | 229 DeferredGpuCommandService::GetInstance(), |
| 219 shared_renderer_state_->GetSharedContext()); | 230 shared_renderer_state_->GetSharedContext()); |
| 220 scoped_ptr<ParentOutputSurface> output_surface_holder( | 231 scoped_ptr<ParentOutputSurface> output_surface_holder( |
| 221 new ParentOutputSurface(context_provider)); | 232 new ParentOutputSurface(context_provider)); |
| 222 output_surface_ = output_surface_holder.get(); | 233 output_surface_ = output_surface_holder.get(); |
| 223 return output_surface_holder.PassAs<cc::OutputSurface>(); | 234 return output_surface_holder.PassAs<cc::OutputSurface>(); |
| 224 } | 235 } |
| 225 | 236 |
| 226 void HardwareRenderer::UnusedResourcesAreAvailable() { | 237 void HardwareRenderer::UnusedResourcesAreAvailable() { |
| 227 cc::ReturnedResourceArray returned_resources; | 238 cc::ReturnedResourceArray returned_resources; |
| 228 resource_collection_->TakeUnusedResourcesForChildCompositor( | 239 resource_collection_->TakeUnusedResourcesForChildCompositor( |
| 229 &returned_resources); | 240 &returned_resources); |
| 230 shared_renderer_state_->InsertReturnedResources(returned_resources); | 241 shared_renderer_state_->InsertReturnedResources(returned_resources); |
| 231 } | 242 } |
| 232 | 243 |
| 233 } // namespace android_webview | 244 } // namespace android_webview |
| OLD | NEW |