1 /* Copyright (c) 2012 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.
7 * This file defines the <code>PPB_Core</code> interface defined by the browser
8 * and containing pointers to functions related to memory management, time, and
17 * The <code>PPB_Core</code> interface contains pointers to functions related
18 * to memory management, time, and threads on the browser.
24 * AddRefResource() adds a reference to a resource.
26 * @param[in] config A <code>PP_Resource</code> corresponding to a
29 void AddRefResource
([in] PP_Resource resource
);
32 * ReleaseResource() removes a reference from a resource.
34 * @param[in] config A <code>PP_Resource</code> corresponding to a
37 void ReleaseResource
([in] PP_Resource resource
);
40 * GetTime() returns the "wall clock time" according to the
43 * @return A <code>PP_Time</code> containing the "wall clock time" according
49 * GetTimeTicks() returns the "tick time" according to the browser.
50 * This clock is used by the browser when passing some event times to the
51 * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code>
52 * field). It is not correlated to any actual wall clock time
53 * (like GetTime()). Because of this, it will not run change if the user
54 * changes their computer clock.
56 * @return A <code>PP_TimeTicks</code> containing the "tick time" according
59 PP_TimeTicks GetTimeTicks
();
62 * CallOnMainThread() schedules work to be executed on the main module thread
63 * after the specified delay. The delay may be 0 to specify a call back as
66 * The <code>result</code> parameter will just be passed as the second
67 * argument to the callback. Many applications won't need this, but it allows
68 * a module to emulate calls of some callbacks which do use this value.
70 * <strong>Note:</strong> CallOnMainThread, even when used from the main
71 * thread with a delay of 0 milliseconds, will never directly invoke the
72 * callback. Even in this case, the callback will be scheduled
75 * <strong>Note:</strong> If the browser is shutting down or if the module
76 * has no instances, then the callback function may not be called.
78 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds.
79 * @param[in] callback A <code>PP_CompletionCallback</code> callback function
80 * that the browser will call after the specified delay.
81 * @param[in] result An int32_t that the browser will pass to the given
82 * <code>PP_CompletionCallback</code>.
84 void CallOnMainThread
(
85 [in] int32_t delay_in_milliseconds
,
86 [in] PP_CompletionCallback
callback,
90 * IsMainThread() returns true if the current thread is the main pepper
93 * This function is useful for implementing sanity checks, and deciding if
94 * dispatching using CallOnMainThread() is required.
96 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
97 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>.
99 PP_Bool IsMainThread
();