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

Side by Side Diff: android_webview/browser/deferred_gpu_command_service.cc

Issue 920443003: Android: SetCreateContextCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: base::Bind Created 5 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
« no previous file with comments | « no previous file | content/browser/android/in_process/synchronous_compositor_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/deferred_gpu_command_service.h" 5 #include "android_webview/browser/deferred_gpu_command_service.h"
6 6
7 #include "android_webview/browser/gl_view_renderer_manager.h" 7 #include "android_webview/browser/gl_view_renderer_manager.h"
8 #include "android_webview/browser/shared_renderer_state.h" 8 #include "android_webview/browser/shared_renderer_state.h"
9 #include "base/bind.h"
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
10 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
11 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
12 #include "content/public/browser/android/synchronous_compositor.h" 13 #include "content/public/browser/android/synchronous_compositor.h"
13 #include "gpu/command_buffer/service/shader_translator_cache.h" 14 #include "gpu/command_buffer/service/shader_translator_cache.h"
14 15
15 namespace android_webview { 16 namespace android_webview {
16 17
17 namespace { 18 namespace {
19
18 base::LazyInstance<scoped_refptr<DeferredGpuCommandService> > 20 base::LazyInstance<scoped_refptr<DeferredGpuCommandService> >
19 g_service = LAZY_INSTANCE_INITIALIZER; 21 g_service = LAZY_INSTANCE_INITIALIZER;
22
23 content::SynchronousCompositor::ContextHolder GetContextHolder(
24 bool need_share_group_with_parent,
25 const blink::WebGraphicsContext3D::Attributes& attributes,
26 bool is_offscreen) {
27 content::SynchronousCompositor::ContextHolder holder;
28 return holder;
tfarina 2015/02/21 16:39:08 What I should put here?
boliu 2015/02/23 21:33:07 The this callback is replacing the CreateOffscreen
tfarina 2015/02/24 17:02:34 Done.
29 }
30
20 } // namespace 31 } // namespace
21 32
22 base::LazyInstance<base::ThreadLocalBoolean> ScopedAllowGL::allow_gl; 33 base::LazyInstance<base::ThreadLocalBoolean> ScopedAllowGL::allow_gl;
23 34
24 // static 35 // static
25 bool ScopedAllowGL::IsAllowed() { 36 bool ScopedAllowGL::IsAllowed() {
26 return allow_gl.Get().Get(); 37 return allow_gl.Get().Get();
27 } 38 }
28 39
29 ScopedAllowGL::ScopedAllowGL() { 40 ScopedAllowGL::ScopedAllowGL() {
(...skipping 13 matching lines...) Expand all
43 if (service->IdleQueueSize()) { 54 if (service->IdleQueueSize()) {
44 service->RequestProcessGL(); 55 service->RequestProcessGL();
45 } 56 }
46 } 57 }
47 } 58 }
48 59
49 // static 60 // static
50 void DeferredGpuCommandService::SetInstance() { 61 void DeferredGpuCommandService::SetInstance() {
51 if (!g_service.Get().get()) { 62 if (!g_service.Get().get()) {
52 g_service.Get() = new DeferredGpuCommandService; 63 g_service.Get() = new DeferredGpuCommandService;
53 content::SynchronousCompositor::SetGpuService(g_service.Get()); 64 content::SynchronousCompositor::SetCreateContextCallback(
65 base::Bind(&GetContextHolder));
54 } 66 }
55 } 67 }
56 68
57 // static 69 // static
58 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() { 70 DeferredGpuCommandService* DeferredGpuCommandService::GetInstance() {
59 DCHECK(g_service.Get().get()); 71 DCHECK(g_service.Get().get());
60 return g_service.Get().get(); 72 return g_service.Get().get();
61 } 73 }
62 74
63 DeferredGpuCommandService::DeferredGpuCommandService() {} 75 DeferredGpuCommandService::DeferredGpuCommandService() {}
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 188
177 void DeferredGpuCommandService::AddRef() const { 189 void DeferredGpuCommandService::AddRef() const {
178 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef(); 190 base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef();
179 } 191 }
180 192
181 void DeferredGpuCommandService::Release() const { 193 void DeferredGpuCommandService::Release() const {
182 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release(); 194 base::RefCountedThreadSafe<DeferredGpuCommandService>::Release();
183 } 195 }
184 196
185 } // namespace android_webview 197 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/in_process/synchronous_compositor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698