• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 Marshall A. Greenblatt. Portons copyright (c) 2012
2 // Google Inc. All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
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
13 // distribution.
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.
18 //
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.
30 //
31 // ---------------------------------------------------------------------------
32 //
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.
36 //
37 
38 // See cef_trace_event.h for trace macros and additonal documentation.
39 
40 #ifndef CEF_INCLUDE_CEF_TRACE_H_
41 #define CEF_INCLUDE_CEF_TRACE_H_
42 #pragma once
43 
44 #include "include/cef_base.h"
45 #include "include/cef_callback.h"
46 
47 ///
48 // Implement this interface to receive notification when tracing has completed.
49 // The methods of this class will be called on the browser process UI thread.
50 ///
51 /*--cef(source=client)--*/
52 class CefEndTracingCallback : public virtual CefBaseRefCounted {
53  public:
54   ///
55   // Called after all processes have sent their trace data. |tracing_file| is
56   // the path at which tracing data was written. The client is responsible for
57   // deleting |tracing_file|.
58   ///
59   /*--cef()--*/
60   virtual void OnEndTracingComplete(const CefString& tracing_file) = 0;
61 };
62 
63 ///
64 // Start tracing events on all processes. Tracing is initialized asynchronously
65 // and |callback| will be executed on the UI thread after initialization is
66 // complete.
67 //
68 // If CefBeginTracing was called previously, or if a CefEndTracingAsync call is
69 // pending, CefBeginTracing will fail and return false.
70 //
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.
74 //
75 // Example: "test_MyTest*"
76 // Example: "test_MyTest*,test_OtherStuff"
77 // Example: "-excluded_category1,-excluded_category2"
78 //
79 // This function must be called on the browser process UI thread.
80 ///
81 /*--cef(optional_param=categories,optional_param=callback)--*/
82 bool CefBeginTracing(const CefString& categories,
83                      CefRefPtr<CefCompletionCallback> callback);
84 
85 ///
86 // Stop tracing events on all processes.
87 //
88 // This function will fail and return false if a previous call to
89 // CefEndTracingAsync is already pending or if CefBeginTracing was not called.
90 //
91 // |tracing_file| is the path at which tracing data will be written and
92 // |callback| is the callback that will be executed once all processes have
93 // sent their trace data. If |tracing_file| is empty a new temporary file path
94 // will be used. If |callback| is empty no trace data will be written.
95 //
96 // This function must be called on the browser process UI thread.
97 ///
98 /*--cef(optional_param=tracing_file,optional_param=callback)--*/
99 bool CefEndTracing(const CefString& tracing_file,
100                    CefRefPtr<CefEndTracingCallback> callback);
101 
102 ///
103 // Returns the current system trace time or, if none is defined, the current
104 // high-res time. Can be used by clients to synchronize with the time
105 // information in trace events.
106 ///
107 /*--cef()--*/
108 int64 CefNowFromSystemTraceTime();
109 
110 #endif  // CEF_INCLUDE_CEF_TRACE_H_
111