Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc::ContextProvider Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
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 "webkit/glue/webthread_impl.h" 31 #include "webkit/glue/webthread_impl.h"
32 #include "webkit/gpu/context_provider.h"
piman 2013/02/22 02:54:07 You probably meant to fix this and some other inst
danakj 2013/02/22 03:04:49 oops missed that, thanks.
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;
41 static webkit_glue::WebThreadImpl* g_impl_thread = NULL; 42 static webkit_glue::WebThreadImpl* g_impl_thread = NULL;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 webkit::gpu::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<webkit::gpu::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<webkit::gpu::ContextProvider>
349 CompositorImpl::OffscreenContextProviderForCompositorThread() {
350 if (!null_offscreen_context_provider_)
351 null_offscreen_context_provider_ = new NullContextProvider();
352 return null_offscreen_context_provider_;
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698