Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 28 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 29 #include "content/browser/gpu/gpu_surface_tracker.h" | 29 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 30 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 30 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 31 #include "content/common/gpu/client/context_provider_command_buffer.h" | 31 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 32 #include "content/common/gpu/client/gl_helper.h" | 32 #include "content/common/gpu/client/gl_helper.h" |
| 33 #include "content/common/gpu/client/gpu_channel_host.h" | 33 #include "content/common/gpu/client/gpu_channel_host.h" |
| 34 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 34 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 35 #include "content/common/gpu/gpu_process_launch_causes.h" | 35 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 36 #include "content/public/browser/android/compositor_client.h" | 36 #include "content/public/browser/android/compositor_client.h" |
| 37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 38 #include "gpu/command_buffer/client/gles2_interface.h" | |
| 38 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 39 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 39 #include "third_party/khronos/GLES2/gl2.h" | 40 #include "third_party/khronos/GLES2/gl2.h" |
| 40 #include "third_party/khronos/GLES2/gl2ext.h" | 41 #include "third_party/khronos/GLES2/gl2ext.h" |
| 41 #include "ui/base/android/window_android.h" | 42 #include "ui/base/android/window_android.h" |
| 42 #include "ui/gfx/android/device_display_info.h" | 43 #include "ui/gfx/android/device_display_info.h" |
| 43 #include "ui/gfx/android/java_bitmap.h" | 44 #include "ui/gfx/android/java_bitmap.h" |
| 44 #include "ui/gfx/frame_time.h" | 45 #include "ui/gfx/frame_time.h" |
| 45 #include "webkit/common/gpu/context_provider_in_process.h" | 46 #include "webkit/common/gpu/context_provider_in_process.h" |
| 46 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" | 47 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" |
| 47 | 48 |
| 48 namespace gfx { | 49 namespace gfx { |
| 49 class JavaBitmap; | 50 class JavaBitmap; |
| 50 } | 51 } |
| 51 | 52 |
| 52 namespace { | 53 namespace { |
| 53 | 54 |
| 54 // Used for drawing directly to the screen. Bypasses resizing and swaps. | 55 // Used for drawing directly to the screen. Bypasses resizing and swaps. |
| 55 class DirectOutputSurface : public cc::OutputSurface { | 56 class DirectOutputSurface : public cc::OutputSurface { |
| 56 public: | 57 public: |
| 57 DirectOutputSurface( | 58 DirectOutputSurface( |
| 58 const scoped_refptr<cc::ContextProvider>& context_provider) | 59 const scoped_refptr<cc::ContextProvider>& context_provider) |
| 59 : cc::OutputSurface(context_provider) { | 60 : cc::OutputSurface(context_provider) { |
| 60 capabilities_.adjust_deadline_for_parent = false; | 61 capabilities_.adjust_deadline_for_parent = false; |
| 61 } | 62 } |
| 62 | 63 |
| 63 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE { | 64 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE { |
| 64 surface_size_ = size; | 65 surface_size_ = size; |
| 65 } | 66 } |
| 66 virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE { | 67 virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE { |
| 67 context_provider_->Context3d()->shallowFlushCHROMIUM(); | 68 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
| 68 } | 69 } |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 // Used to override capabilities_.adjust_deadline_for_parent to false | 72 // Used to override capabilities_.adjust_deadline_for_parent to false |
| 72 class OutputSurfaceWithoutParent : public cc::OutputSurface { | 73 class OutputSurfaceWithoutParent : public cc::OutputSurface { |
| 73 public: | 74 public: |
| 74 OutputSurfaceWithoutParent( | 75 OutputSurfaceWithoutParent(const scoped_refptr< |
| 75 const scoped_refptr< | 76 content::ContextProviderCommandBuffer>& context_provider) |
| 76 content::ContextProviderCommandBuffer>& context_provider) | |
| 77 : cc::OutputSurface(context_provider) { | 77 : cc::OutputSurface(context_provider) { |
| 78 capabilities_.adjust_deadline_for_parent = false; | 78 capabilities_.adjust_deadline_for_parent = false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE { | 81 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE { |
| 82 content::WebGraphicsContext3DCommandBufferImpl* command_buffer_context = | 82 content::ContextProviderCommandBuffer* provider_cb = |
|
danakj
2014/01/06 20:59:37
provider_command_buffer?
| |
| 83 static_cast<content::WebGraphicsContext3DCommandBufferImpl*>( | 83 static_cast<content::ContextProviderCommandBuffer*>( |
| 84 context_provider_->Context3d()); | 84 context_provider_.get()); |
| 85 content::CommandBufferProxyImpl* command_buffer_proxy = | 85 content::CommandBufferProxyImpl* command_buffer_proxy = |
| 86 command_buffer_context->GetCommandBufferProxy(); | 86 provider_cb->GetCommandBufferProxy(); |
| 87 DCHECK(command_buffer_proxy); | 87 DCHECK(command_buffer_proxy); |
| 88 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); | 88 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
| 89 | 89 |
| 90 OutputSurface::SwapBuffers(frame); | 90 OutputSurface::SwapBuffers(frame); |
| 91 } | 91 } |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 static bool g_initialized = false; | 94 static bool g_initialized = false; |
| 95 | 95 |
| 96 } // anonymous namespace | 96 } // anonymous namespace |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 default: | 488 default: |
| 489 return GL_UNSIGNED_SHORT_5_6_5; | 489 return GL_UNSIGNED_SHORT_5_6_5; |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 | 492 |
| 493 void CompositorImpl::DidCommit() { | 493 void CompositorImpl::DidCommit() { |
| 494 root_window_->OnCompositingDidCommit(); | 494 root_window_->OnCompositingDidCommit(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace content | 497 } // namespace content |
| OLD | NEW |