1 // Copyright (c) 2012 Marshall A. Greenblatt. Portons copyright (c) 2012
2 // Google Inc. All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
14 // * Neither the name of Google Inc. nor the name Chromium Embedded
15 // Framework nor the names of its contributors may be used to endorse
16 // or promote products derived from this software without specific prior
17 // written permission.
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 // ---------------------------------------------------------------------------
33 // The contents of this file must follow a specific format in order to
34 // support the CEF translator tool. See the translator.README.txt file in the
35 // tools directory for more information.
38 // See cef_trace_event.h for trace macros and additonal documentation.
40 #ifndef CEF_INCLUDE_CEF_TRACE_H_
41 #define CEF_INCLUDE_CEF_TRACE_H_
44 #include "include/cef_base.h"
47 // Implement this interface to receive notification when tracing has completed.
48 // The methods of this class will be called on the browser process UI thread.
50 /*--cef(source=client)--*/
51 class CefEndTracingCallback : public virtual CefBase {
54 // Called after all processes have sent their trace data. |tracing_file| is
55 // the path at which tracing data was written. The client is responsible for
56 // deleting |tracing_file|.
59 virtual void OnEndTracingComplete(const CefString& tracing_file) =0;
64 // Start tracing events on all processes. Tracing begins immediately locally,
65 // and asynchronously on child processes as soon as they receive the
66 // BeginTracing request.
68 // If CefBeginTracing was called previously, or if a CefEndTracingAsync call is
69 // pending, CefBeginTracing will fail and return false.
71 // |categories| is a comma-delimited list of category wildcards. A category can
72 // have an optional '-' prefix to make it an excluded category. Having both
73 // included and excluded categories in the same list is not supported.
75 // Example: "test_MyTest*"
76 // Example: "test_MyTest*,test_OtherStuff"
77 // Example: "-excluded_category1,-excluded_category2"
79 // This function must be called on the browser process UI thread.
81 /*--cef(optional_param=categories)--*/
82 bool CefBeginTracing(const CefString& categories);
85 // Stop tracing events on all processes.
87 // This function will fail and return false if a previous call to
88 // CefEndTracingAsync is already pending or if CefBeginTracing was not called.
90 // |tracing_file| is the path at which tracing data will be written and
91 // |callback| is the callback that will be executed once all processes have
92 // sent their trace data. If |tracing_file| is empty a new temporary file path
93 // will be used. If |callback| is empty no trace data will be written.
95 // This function must be called on the browser process UI thread.
97 /*--cef(optional_param=tracing_file,optional_param=callback)--*/
98 bool CefEndTracingAsync(const CefString& tracing_file,
99 CefRefPtr<CefEndTracingCallback> callback);
102 // Returns the current system trace time or, if none is defined, the current
103 // high-res time. Can be used by clients to synchronize with the time
104 // information in trace events.
107 int64 CefNowFromSystemTraceTime();
109 #endif // CEF_INCLUDE_CEF_TRACE_H_