xref: /aosp_15_r20/external/cronet/net/base/trace_event_stub.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // This file defines stubs for tracing-related classes which are used by net
6 // but are not available in Cronet builds (where tracing is disabled to reduce
7 // binary size).
8 // Even though these stubs are part of the base::trace_event namespace, they're
9 // technically not required by base. So, implement them here to make that
10 // explicit.
11 
12 #ifndef NET_BASE_TRACE_EVENT_STUB_H_
13 #define NET_BASE_TRACE_EVENT_STUB_H_
14 
15 #import "base/base_export.h"
16 #import "base/memory/weak_ptr.h"
17 #import "base/trace_event/trace_event_stub.h"
18 
19 namespace base::trace_event {
20 
21 class BASE_EXPORT TraceLog {
22  public:
23   class BASE_EXPORT AsyncEnabledStateObserver {
24    public:
25     virtual ~AsyncEnabledStateObserver() = default;
26 
27     virtual void OnTraceLogEnabled() = 0;
28     virtual void OnTraceLogDisabled() = 0;
29   };
30 
GetInstance()31   static TraceLog* GetInstance() {
32     static TraceLog obj;
33     return &obj;
34   }
35 
IsEnabled()36   bool IsEnabled() { return false; }
37 
AddAsyncEnabledStateObserver(WeakPtr<AsyncEnabledStateObserver>)38   void AddAsyncEnabledStateObserver(WeakPtr<AsyncEnabledStateObserver>) {}
RemoveAsyncEnabledStateObserver(AsyncEnabledStateObserver *)39   void RemoveAsyncEnabledStateObserver(AsyncEnabledStateObserver*) {}
40 };
41 
42 }  // namespace base::trace_event
43 
44 #endif  // NET_BASE_TRACE_EVENT_STUB_H_
45