Pepper_47_C++_interfaces
|
APIs related to memory management, time, and threads. More...
#include <core.h>
Public Member Functions | |
void | AddRefResource (PP_Resource resource) |
void | ReleaseResource (PP_Resource resource) |
PP_Time | GetTime () |
PP_TimeTicks | GetTimeTicks () |
void | CallOnMainThread (int32_t delay_in_milliseconds, const CompletionCallback &callback, int32_t result=0) |
bool | IsMainThread () |
Friends | |
class | Module |
|
inline |
AddRefResource() increments the reference count for the provided resource
.
[in] | resource | A PP_Resource corresponding to a resource. |
Definition at line 31 of file core.h.
Referenced by pp::ResourceArray_Dev::ArrayOutputCallbackConverter(), pp::DirectoryEntry::DirectoryEntry(), pp::IMEInputEvent::IMEInputEvent(), pp::InputEvent::InputEvent(), pp::KeyboardInputEvent::KeyboardInputEvent(), pp::MouseInputEvent::MouseInputEvent(), pp::Resource::operator=(), pp::DirectoryEntry::operator=(), pp::Resource::Resource(), pp::TouchInputEvent::TouchInputEvent(), and pp::WheelInputEvent::WheelInputEvent().
void pp::Core::CallOnMainThread | ( | int32_t | delay_in_milliseconds, |
const CompletionCallback & | callback, | ||
int32_t | result = 0 |
||
) |
CallOnMainThread() schedules work to be executed on the main pepper thread after the specified delay. The delay may be 0 to specify a call back as soon as possible.
The |result| parameter will just be passed as the second argument to the callback. Many applications won't need this, but it allows a module to emulate calls of some callbacks which do use this value.
Note: CallOnMainThread(), even when used from the main thread with a delay of 0 milliseconds, will never directly invoke the callback. Even in this case, the callback will be scheduled asynchronously.
Note: If the browser is shutting down or if the module has no instances, then the callback function may not be called.
[in] | delay_in_milliseconds | An int32_t delay in milliseconds. |
[in] | callback | A CompletionCallback callback function that the browser will call after the specified delay. |
[in] | result | An int32_t that the browser will pass to the given CompletionCallback . |
Definition at line 13 of file core.cc.
References pp::CompletionCallback::pp_completion_callback().
Referenced by pp::CompletionCallback::MayForce().
|
inline |
|
inline |
GetTimeTicks() returns the "tick time" according to the browser. This clock is used by the browser when passing some event times to the module (for example, using the PP_InputEvent::time_stamp_seconds
field). It is not correlated to any actual wall clock time (like GetTime()). Because of this, it will not change if the user changes their computer clock.
PP_TimeTicks
containing the "tick time" according to the browser. bool pp::Core::IsMainThread | ( | ) |
IsMainThread() returns true if the current thread is the main pepper thread.
This function is useful for implementing sanity checks, and deciding if dispatching using CallOnMainThread() is required.
|
inline |
ReleaseResource() decrements the reference count for the provided resource
. The resource will be deallocated if the reference count reaches zero.
[in] | resource | A PP_Resource corresponding to a resource. |
Definition at line 41 of file core.h.
Referenced by pp::Resource::Clear(), pp::Resource::operator=(), pp::DirectoryEntry::operator=(), pp::DirectoryEntry::~DirectoryEntry(), and pp::Resource::~Resource().