1 // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 2 // reserved. Use of this source code is governed by a BSD-style license that can 3 // be found in the LICENSE file. 4 5 #ifndef CEF_LIBCEF_BROWSER_TRACE_SUBSCRIBER_H_ 6 #define CEF_LIBCEF_BROWSER_TRACE_SUBSCRIBER_H_ 7 #pragma once 8 9 #include "include/cef_trace.h" 10 11 #include "base/files/file_path.h" 12 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/weak_ptr.h" 14 15 // May only be accessed on the browser process UI thread. 16 class CefTraceSubscriber { 17 public: 18 CefTraceSubscriber(); 19 virtual ~CefTraceSubscriber(); 20 21 bool BeginTracing(const std::string& categories, 22 CefRefPtr<CefCompletionCallback> callback); 23 bool EndTracing(const base::FilePath& tracing_file, 24 CefRefPtr<CefEndTracingCallback> callback); 25 26 private: 27 void ContinueEndTracing(CefRefPtr<CefEndTracingCallback> callback, 28 const base::FilePath& tracing_file); 29 void OnTracingFileResult(CefRefPtr<CefEndTracingCallback> callback, 30 const base::FilePath& tracing_file); 31 32 bool collecting_trace_data_; 33 base::WeakPtrFactory<CefTraceSubscriber> weak_factory_; 34 }; 35 36 #endif // CEF_LIBCEF_BROWSER_TRACE_SUBSCRIBER_H_ 37