Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
core.h
Go to the documentation of this file.
1 // Copyright (c) 2011 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 PPAPI_CPP_CORE_H_
6 #define PPAPI_CPP_CORE_H_
7 
8 #include <stdint.h>
9 
10 #include "ppapi/c/ppb_core.h"
11 
14 
15 namespace pp {
16 
17 class CompletionCallback;
18 class Module;
19 
21 class Core {
22  public:
23  // Note that we explicitly don't expose Resource& versions of this function
24  // since Resource will normally manage the refcount properly. These should
25  // be called only when doing manual management on raw PP_Resource handles,
26  // which should be fairly rare.
27 
33  void AddRefResource(PP_Resource resource) {
34  interface_->AddRefResource(resource);
35  }
36 
43  void ReleaseResource(PP_Resource resource) {
44  interface_->ReleaseResource(resource);
45  }
46 
52  PP_Time GetTime() {
53  return interface_->GetTime();
54  }
55 
65  PP_TimeTicks GetTimeTicks() {
66  return interface_->GetTimeTicks();
67  }
68 
90  void CallOnMainThread(int32_t delay_in_milliseconds,
91  const CompletionCallback& callback,
92  int32_t result = 0);
93 
94 
103  bool IsMainThread();
104 
105  private:
106  // Allow Module to construct.
107  friend class Module;
108 
109  // Only module should make this class so this constructor is private.
110  Core(const PPB_Core* inter) : interface_(inter) {}
111 
112  // Copy and assignment are disallowed.
113  Core(const Core& other);
114  Core& operator=(const Core& other);
115 
116  const PPB_Core* interface_;
117 };
118 
119 } // namespace pp
120 
121 #endif // PPAPI_CPP_CORE_H_
void AddRefResource(PP_Resource resource)
Definition: core.h:33
void ReleaseResource(PP_Resource resource)
Definition: core.h:43
PP_Time GetTime()
Definition: core.h:52
Definition: completion_callback.h:26
void CallOnMainThread(int32_t delay_in_milliseconds, const CompletionCallback &callback, int32_t result=0)
Definition: module.h:29
PP_TimeTicks GetTimeTicks()
Definition: core.h:65
bool IsMainThread()
APIs related to memory management, time, and threads.
Definition: core.h:21