OLD | NEW |
---|---|
(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 MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_ | |
6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "mojo/public/system/core_cpp.h" | |
12 #include "ppapi/shared_impl/ppapi_globals.h" | |
13 #include "ppapi/shared_impl/resource_tracker.h" | |
14 | |
15 namespace base { | |
16 class MessageLoopProxy; | |
17 } | |
18 | |
19 namespace mojo { | |
20 namespace examples { | |
21 | |
22 class PluginInstance; | |
23 | |
24 class MojoPpapiGlobals : public ppapi::PpapiGlobals { | |
25 public: | |
26 class Delegate { | |
27 public: | |
28 virtual ~Delegate() {} | |
29 | |
30 virtual ScopedMessagePipeHandle CreateGLES2Context() = 0; | |
31 }; | |
32 | |
33 // |delegate| must live longer than this object. | |
34 explicit MojoPpapiGlobals(Delegate* delegate); | |
35 virtual ~MojoPpapiGlobals(); | |
36 | |
37 inline static MojoPpapiGlobals* Get() { | |
38 return static_cast<MojoPpapiGlobals*>(PpapiGlobals::Get()); | |
39 } | |
40 | |
41 PP_Instance AddInstance(PluginInstance* instance); | |
42 void InstanceDeleted(PP_Instance instance); | |
43 PluginInstance* GetInstance(PP_Instance instance); | |
44 | |
45 ScopedMessagePipeHandle CreateGLES2Context(); | |
46 | |
47 // ppapi::PpapiGlobals implementation. | |
48 virtual ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; | |
49 virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; | |
50 virtual ppapi::CallbackTracker* GetCallbackTrackerForInstance( | |
51 PP_Instance instance) OVERRIDE; | |
52 virtual void LogWithSource(PP_Instance instance, | |
53 PP_LogLevel level, | |
54 const std::string& source, | |
55 const std::string& value) OVERRIDE; | |
56 virtual void BroadcastLogWithSource(PP_Module module, | |
57 PP_LogLevel level, | |
58 const std::string& source, | |
59 const std::string& value) OVERRIDE; | |
60 virtual ppapi::thunk::PPB_Instance_API* GetInstanceAPI( | |
61 PP_Instance instance) OVERRIDE; | |
62 virtual ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI( | |
63 PP_Instance instance) OVERRIDE; | |
64 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; | |
65 virtual ppapi::MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; | |
66 virtual base::TaskRunner* GetFileTaskRunner() OVERRIDE; | |
67 virtual std::string GetCmdLine() OVERRIDE; | |
68 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE; | |
69 | |
70 private: | |
71 class MainThreadMessageLoopResource; | |
72 | |
73 static const PP_Instance kInstanceId; | |
viettrungluu
2014/03/21 04:20:00
There's no advantage in declaring this in the head
yzshen1
2014/03/21 17:52:08
Right!
| |
74 | |
75 // Non-owning pointer. | |
76 Delegate* delegate_; | |
viettrungluu
2014/03/21 04:20:00
Nit: I'd make this const (i.e., Delegate* const),
yzshen1
2014/03/21 17:52:08
Done.
| |
77 | |
78 // Non-owning pointer. | |
79 PluginInstance* plugin_instance_; | |
80 | |
81 ppapi::ResourceTracker resource_tracker_; | |
82 | |
83 scoped_refptr<base::MessageLoopProxy> main_thread_message_loop_; | |
viettrungluu
2014/03/21 04:20:00
I don't think you need/use this.
yzshen1
2014/03/21 17:52:08
Right. I defined it and later realized that the ba
| |
84 scoped_refptr<MainThreadMessageLoopResource> | |
85 main_thread_message_loop_resource_; | |
86 | |
87 DISALLOW_COPY_AND_ASSIGN(MojoPpapiGlobals); | |
88 }; | |
89 | |
90 } // namespace examples | |
91 } // namespace mojo | |
92 | |
93 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_MOJO_PPAPI_GLOBALS_H_ | |
OLD | NEW |