cef/libcef/browser/trace_impl.cc
Marshall Greenblatt 6702fc573a Introduce the use of Chromium types (issue #1336).
- Move include/cef_build.h to include/base/cef_build.h.
- Move libcef_dll/cef_macros.h to include/base/cef_macros.h.
- Move include/cef_trace_event.h to include/base/cef_trace_event.h and include/internal/cef_trace_event_internal.h.
- Remove the "CEF_" prefix from TRACE macros.
- Add new include/base/cef_logging.h and include/internal/cef_logging_internal.h for logging support.
- Add new include/wrapper/cef_helpers.h for CEF_REQUIRE_*_THREAD macros and CefScopedArgArray.
- Delete the util.h headers used by tests that duplicated the above functionality.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1767 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2014-07-11 20:10:05 +00:00

53 lines
1.4 KiB
C++

// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#include "include/cef_trace.h"
#include "libcef/browser/trace_subscriber.h"
#include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h"
#include "base/time/time.h"
bool CefBeginTracing(const CefString& categories,
CefRefPtr<CefCompletionCallback> callback) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return false;
}
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return false;
}
CefTraceSubscriber* subscriber = CefContext::Get()->GetTraceSubscriber();
if (!subscriber)
return false;
return subscriber->BeginTracing(categories, callback);
}
bool CefEndTracing(const CefString& tracing_file,
CefRefPtr<CefEndTracingCallback> callback) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return false;
}
if (!CEF_CURRENTLY_ON_UIT()) {
NOTREACHED() << "called on invalid thread";
return false;
}
CefTraceSubscriber* subscriber = CefContext::Get()->GetTraceSubscriber();
if (!subscriber)
return false;
return subscriber->EndTracing(base::FilePath(tracing_file), callback);
}
int64 CefNowFromSystemTraceTime() {
return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue();
}