12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef PPAPI_SHARED_IMPL_PPB_TRACE_EVENT_IMPL_H_
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define PPAPI_SHARED_IMPL_PPB_TRACE_EVENT_IMPL_H_
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/c/dev/ppb_trace_event_dev.h"
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/c/pp_bool.h"
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/shared_impl/ppapi_shared_export.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace ppapi {
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Contains the implementation of the PPB_Trace_Event_Dev functions. Since these
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// functions are to be run from whatever plugin process/thread in which they
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// originated, the implementation lives in shared_impl.
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)//
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PPAPI_SHARED_EXPORT TraceEventImpl {
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static void* GetCategoryEnabled(const char* category_name);
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  static void AddTraceEvent(int8_t phase,
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            const void* category_enabled,
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            const char* name,
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            uint64_t id,
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            uint32_t num_args,
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            const char* arg_names[],
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            const uint8_t arg_types[],
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            const uint64_t arg_values[],
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                            uint8_t flags);
30eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  static void AddTraceEventWithThreadIdAndTimestamp(
31eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      int8_t phase,
32eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      const void* category_enabled,
33eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      const char* name,
34eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      uint64_t id,
35eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      int32_t thread_id,
36eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      int64_t timestamp,
37eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      uint32_t num_args,
38eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      const char* arg_names[],
39eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      const uint8_t arg_types[],
40eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      const uint64_t arg_values[],
41eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      uint8_t flags);
42eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  static int64_t Now();
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static void SetThreadName(const char* thread_name);
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace ppapi
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // PPAPI_SHARED_IMPL_PPB_TRACE_EVENT_IMPL_H_
49