chromium/cc/base/devtools_instrumentation.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_BASE_DEVTOOLS_INSTRUMENTATION_H_
#define CC_BASE_DEVTOOLS_INSTRUMENTATION_H_

#include <stdint.h>

#include <memory>
#include <utility>

#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "base/trace_event/typed_macros.h"
#include "cc/base/base_export.h"

namespace cc {
namespace devtools_instrumentation {

namespace internal {
struct CC_BASE_EXPORT CategoryName {};

CC_BASE_EXPORT extern const char kData[];
CC_BASE_EXPORT extern const char kFrameId[];
CC_BASE_EXPORT extern const char kLayerId[];
CC_BASE_EXPORT extern const char kLayerTreeId[];
CC_BASE_EXPORT extern const char kPixelRefId[];
CC_BASE_EXPORT extern const char kFrameSequenceNumber[];
CC_BASE_EXPORT extern const char kHasPartialUpdate[];

CC_BASE_EXPORT extern const char kImageDecodeTask[];
CC_BASE_EXPORT extern const char kBeginFrame[];
CC_BASE_EXPORT extern const char kNeedsBeginFrameChanged[];
CC_BASE_EXPORT extern const char kActivateLayerTree[];
CC_BASE_EXPORT extern const char kRequestMainThreadFrame[];
CC_BASE_EXPORT extern const char kDroppedFrame[];
CC_BASE_EXPORT extern const char kBeginMainThreadFrame[];
CC_BASE_EXPORT extern const char kDrawFrame[];
CC_BASE_EXPORT extern const char kCommit[];
}  // namespace internal

extern const char kPaintSetup[];
CC_BASE_EXPORT extern const char kUpdateLayer[];

class CC_BASE_EXPORT ScopedLayerTask {};

class CC_BASE_EXPORT ScopedImageTask {};

class CC_BASE_EXPORT ScopedImageUploadTask : public ScopedImageTask {};

class CC_BASE_EXPORT ScopedImageDecodeTask : public ScopedImageTask {};

class CC_BASE_EXPORT ScopedLayerTreeTask {};

struct CC_BASE_EXPORT ScopedCommitTrace {};

struct CC_BASE_EXPORT ScopedLayerObjectTracker
    : public base::trace_event::
          TraceScopedTrackableObject<int, internal::CategoryName::kTimeline> {};

inline void CC_BASE_EXPORT DidActivateLayerTree(int layer_tree_host_id,
                                                int frame_id) {}

inline void CC_BASE_EXPORT DidBeginFrame(int layer_tree_host_id,
                                         base::TimeTicks begin_frame_timestamp,
                                         uint64_t sequence_number) {}

inline void CC_BASE_EXPORT DidDrawFrame(int layer_tree_host_id,
                                        uint64_t sequence_number) {}

inline void CC_BASE_EXPORT DidRequestMainThreadFrame(int layer_tree_host_id) {}

inline void CC_BASE_EXPORT
DidDropSmoothnessFrame(int layer_tree_host_id,
                       base::TimeTicks dropped_frame_timestamp,
                       uint64_t sequence_number,
                       bool has_partial_update) {}

inline std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
BeginMainThreadFrameData(int frame_id) {}

inline void CC_BASE_EXPORT WillBeginMainThreadFrame(int layer_tree_host_id,
                                                    int frame_id) {}

inline std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
NeedsBeginFrameData(bool needs_begin_frame) {}

inline void CC_BASE_EXPORT NeedsBeginFrameChanged(int layer_tree_host_id,
                                                  bool new_value) {}

}  // namespace devtools_instrumentation
}  // namespace cc

#endif  // CC_BASE_DEVTOOLS_INSTRUMENTATION_H_