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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/browser/gpu/gpu_surface_tracker.h" | 21 #include "content/browser/gpu/gpu_surface_tracker.h" |
22 #include "content/browser/renderer_host/image_transport_factory_android.h" | 22 #include "content/browser/renderer_host/image_transport_factory_android.h" |
23 #include "content/common/gpu/client/gl_helper.h" | 23 #include "content/common/gpu/client/gl_helper.h" |
24 #include "content/common/gpu/client/gpu_channel_host.h" | 24 #include "content/common/gpu/client/gpu_channel_host.h" |
25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
26 #include "content/common/gpu/gpu_process_launch_causes.h" | 26 #include "content/common/gpu/gpu_process_launch_causes.h" |
27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
28 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
29 #include "third_party/khronos/GLES2/gl2ext.h" | 29 #include "third_party/khronos/GLES2/gl2ext.h" |
30 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 30 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 31 #include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsCo
ntext3D.h" |
31 #include "ui/gfx/android/java_bitmap.h" | 32 #include "ui/gfx/android/java_bitmap.h" |
32 #include "webkit/glue/webthread_impl.h" | 33 #include "webkit/glue/webthread_impl.h" |
33 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 34 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
34 | 35 |
35 namespace gfx { | 36 namespace gfx { |
36 class JavaBitmap; | 37 class JavaBitmap; |
37 } | 38 } |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 false, | 334 false, |
334 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE))
{ | 335 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE))
{ |
335 LOG(ERROR) << "Failed to create 3D context for compositor."; | 336 LOG(ERROR) << "Failed to create 3D context for compositor."; |
336 return scoped_ptr<cc::OutputSurface>(); | 337 return scoped_ptr<cc::OutputSurface>(); |
337 } | 338 } |
338 return scoped_ptr<cc::OutputSurface>( | 339 return scoped_ptr<cc::OutputSurface>( |
339 new WebGraphicsContextToOutputSurfaceAdapter(context.release())); | 340 new WebGraphicsContextToOutputSurfaceAdapter(context.release())); |
340 } | 341 } |
341 } | 342 } |
342 | 343 |
| 344 WebKit::WebGraphicsContext3D* CompositorImpl:: |
| 345 OffscreenContext3dForMainThread() { |
| 346 return WebKit::WebSharedGraphicsContext3D::mainThreadContext(); |
| 347 } |
| 348 |
| 349 WebKit::WebGraphicsContext3D* CompositorImpl:: |
| 350 OffscreenContext3dForCompositorThread() { |
| 351 if (!WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext() && |
| 352 !WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext()) |
| 353 return NULL; |
| 354 return WebKit::WebSharedGraphicsContext3D::compositorThreadContext(); |
| 355 } |
| 356 |
| 357 GrContext* CompositorImpl::OffscreenGrContextForMainThread() { |
| 358 return WebKit::WebSharedGraphicsContext3D::mainThreadGrContext(); |
| 359 } |
| 360 |
| 361 GrContext* CompositorImpl::OffscreenGrContextForCompositorThread() { |
| 362 return WebKit::WebSharedGraphicsContext3D::compositorThreadGrContext(); |
| 363 } |
| 364 |
343 scoped_ptr<cc::InputHandler> CompositorImpl::createInputHandler() { | 365 scoped_ptr<cc::InputHandler> CompositorImpl::createInputHandler() { |
344 return scoped_ptr<cc::InputHandler>(); | 366 return scoped_ptr<cc::InputHandler>(); |
345 } | 367 } |
346 | 368 |
347 void CompositorImpl::didRecreateOutputSurface(bool success) { | 369 void CompositorImpl::didRecreateOutputSurface(bool success) { |
348 } | 370 } |
349 | 371 |
350 void CompositorImpl::didCommit() { | 372 void CompositorImpl::didCommit() { |
351 } | 373 } |
352 | 374 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 446 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
425 return GL_UNSIGNED_BYTE; | 447 return GL_UNSIGNED_BYTE; |
426 break; | 448 break; |
427 case ANDROID_BITMAP_FORMAT_RGB_565: | 449 case ANDROID_BITMAP_FORMAT_RGB_565: |
428 default: | 450 default: |
429 return GL_UNSIGNED_SHORT_5_6_5; | 451 return GL_UNSIGNED_SHORT_5_6_5; |
430 } | 452 } |
431 } | 453 } |
432 | 454 |
433 } // namespace content | 455 } // namespace content |
OLD | NEW |