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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_factory_impl.h

Issue 102963010: Move SynchronousCompositorFactoryImpl into separate h/cc files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move a TODO comment Created 6 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H _
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMPL_H _
7
8 #include "base/synchronization/lock.h"
9 #include "content/browser/android/in_process/synchronous_input_event_filter.h"
10 #include "content/renderer/android/synchronous_compositor_factory.h"
11 #include "content/renderer/media/android/stream_texture_factory_android_synchron ous_impl.h"
12
13 namespace gpu {
14 class GLInProcessContext;
15 }
16
17 namespace webkit {
18 namespace gpu {
19 class WebGraphicsContext3DInProcessCommandBufferImpl;
20 }
21 }
22
23 namespace content {
24
25 class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
26 public:
27 SynchronousCompositorFactoryImpl();
28 virtual ~SynchronousCompositorFactoryImpl();
29
30 // SynchronousCompositorFactory
31 virtual scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop()
32 OVERRIDE;
33 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(int routing_id)
34 OVERRIDE;
35 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE;
36 virtual scoped_refptr<cc::ContextProvider>
37 GetOffscreenContextProviderForMainThread() OVERRIDE;
38 // This is called on both renderer main thread (offscreen context creation
39 // path shared between cross-process and in-process platforms) and renderer
40 // compositor impl thread (InitializeHwDraw) in order to support Android
41 // WebView synchronously enable and disable hardware mode multiple times in
42 // the same task. This is ok because in-process WGC3D creation may happen on
43 // any thread and is lightweight.
44 virtual scoped_refptr<cc::ContextProvider>
45 GetOffscreenContextProviderForCompositorThread() OVERRIDE;
46 virtual scoped_ptr<StreamTextureFactory> CreateStreamTextureFactory(
47 int view_id) OVERRIDE;
48
49 SynchronousInputEventFilter* synchronous_input_event_filter() {
50 return &synchronous_input_event_filter_;
51 }
52
53 void CompositorInitializedHardwareDraw();
54 void CompositorReleasedHardwareDraw();
55
56 private:
57 void ReleaseGlobalHardwareResources();
58 bool CanCreateMainThreadContext();
59 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>
60 TryCreateStreamTextureFactory();
61 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
62 CreateOffscreenContext();
63
64 SynchronousInputEventFilter synchronous_input_event_filter_;
65
66 // Only guards construction and destruction of
67 // |offscreen_context_for_compositor_thread_|, not usage.
68 base::Lock offscreen_context_for_compositor_thread_lock_;
69 scoped_refptr<cc::ContextProvider> offscreen_context_for_main_thread_;
70 // This is a pointer to the context owned by
71 // |offscreen_context_for_main_thread_|.
72 gpu::GLInProcessContext* wrapped_gl_context_for_main_thread_;
73 scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_;
74
75 // |num_hardware_compositor_lock_| is updated on UI thread only but can be
76 // read on renderer main thread.
77 base::Lock num_hardware_compositor_lock_;
78 unsigned int num_hardware_compositors_;
79 };
80
81 } // namespace content
82
83 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_COMPOSITOR_FACTORY_IMP L_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698