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/renderer_host/image_transport_factory_android.h" | 21 #include "content/browser/renderer_host/image_transport_factory_android.h" |
22 #include "content/common/gpu/client/gl_helper.h" | 22 #include "content/common/gpu/client/gl_helper.h" |
23 #include "content/common/gpu/client/gpu_channel_host.h" | 23 #include "content/common/gpu/client/gpu_channel_host.h" |
24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
25 #include "content/common/gpu/gpu_process_launch_causes.h" | 25 #include "content/common/gpu/gpu_process_launch_causes.h" |
26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
27 #include "third_party/khronos/GLES2/gl2.h" | 27 #include "third_party/khronos/GLES2/gl2.h" |
28 #include "third_party/khronos/GLES2/gl2ext.h" | 28 #include "third_party/khronos/GLES2/gl2ext.h" |
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" |
30 #include "ui/gfx/android/java_bitmap.h" | 30 #include "ui/gfx/android/java_bitmap.h" |
31 #include "ui/gl/context_provider.h" | |
31 #include "webkit/glue/webthread_impl.h" | 32 #include "webkit/glue/webthread_impl.h" |
32 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 33 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
33 | 34 |
34 namespace gfx { | 35 namespace gfx { |
35 class JavaBitmap; | 36 class JavaBitmap; |
36 } | 37 } |
37 | 38 |
38 namespace { | 39 namespace { |
39 | 40 |
40 static bool g_initialized = false; | 41 static bool g_initialized = false; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 } | 320 } |
320 | 321 |
321 void CompositorImpl::didCompleteSwapBuffers() { | 322 void CompositorImpl::didCompleteSwapBuffers() { |
322 client_->OnSwapBuffersCompleted(); | 323 client_->OnSwapBuffersCompleted(); |
323 } | 324 } |
324 | 325 |
325 void CompositorImpl::scheduleComposite() { | 326 void CompositorImpl::scheduleComposite() { |
326 client_->ScheduleComposite(); | 327 client_->ScheduleComposite(); |
327 } | 328 } |
328 | 329 |
330 class NullContextProvider : public ui::ContextProvider { | |
331 // TODO(danakj): Get a context through ImageTransportSurfaceAndroid. | |
332 virtual bool InitializeOnMainThread() { return false; } | |
333 virtual bool BindToCurrentThread() { return false; } | |
334 virtual WebKit::WebGraphicsContext3D* Context3d() { return NULL; } | |
335 virtual class GrContext* GrContext() { return NULL; } | |
336 virtual void VerifyContexts() {} | |
337 protected: | |
338 virtual ~NullContextProvider() {} | |
339 }; | |
340 | |
341 scoped_refptr<ui::ContextProvider> | |
342 CompositorImpl::OffscreenContextProviderForMainThread() { | |
343 if (!null_offscreen_context_provider_) | |
344 null_offscreen_context_provider_ = new NullContextProvider(); | |
345 return null_offscreen_context_provider_; | |
346 } | |
347 | |
348 scoped_refptr<ui::ContextProvider> | |
349 CompositorImpl::OffscreenContextProviderForCompositorThread() { | |
350 if (!null_offscreen_context_provider_) | |
351 null_offscreen_context_provider_ = new NullContextProvider(); | |
352 return null_offscreen_context_provider_; | |
piman
2013/02/21 22:49:48
I assume that Android UI doesn't use filters right
danakj
2013/02/22 01:56:31
Right. And don't intend to use filters that will r
piman
2013/02/22 02:54:07
Worth a comment? "If you're trying to use filters
danakj
2013/02/22 03:04:49
ya, sure! the world won't blow cuz we nullcheck th
| |
353 } | |
354 | |
329 void CompositorImpl::OnViewContextSwapBuffersPosted() { | 355 void CompositorImpl::OnViewContextSwapBuffersPosted() { |
330 TRACE_EVENT0("compositor", "CompositorImpl::OnViewContextSwapBuffersPosted"); | 356 TRACE_EVENT0("compositor", "CompositorImpl::OnViewContextSwapBuffersPosted"); |
331 } | 357 } |
332 | 358 |
333 void CompositorImpl::OnViewContextSwapBuffersComplete() { | 359 void CompositorImpl::OnViewContextSwapBuffersComplete() { |
334 TRACE_EVENT0("compositor", | 360 TRACE_EVENT0("compositor", |
335 "CompositorImpl::OnViewContextSwapBuffersComplete"); | 361 "CompositorImpl::OnViewContextSwapBuffersComplete"); |
336 client_->OnSwapBuffersCompleted(); | 362 client_->OnSwapBuffersCompleted(); |
337 } | 363 } |
338 | 364 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 411 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
386 return GL_UNSIGNED_BYTE; | 412 return GL_UNSIGNED_BYTE; |
387 break; | 413 break; |
388 case ANDROID_BITMAP_FORMAT_RGB_565: | 414 case ANDROID_BITMAP_FORMAT_RGB_565: |
389 default: | 415 default: |
390 return GL_UNSIGNED_SHORT_5_6_5; | 416 return GL_UNSIGNED_SHORT_5_6_5; |
391 } | 417 } |
392 } | 418 } |
393 | 419 |
394 } // namespace content | 420 } // namespace content |
OLD | NEW |