OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_CAPTURING_NET_LOG_H_ | 5 #ifndef NET_BASE_CAPTURING_NET_LOG_H_ |
6 #define NET_BASE_CAPTURING_NET_LOG_H_ | 6 #define NET_BASE_CAPTURING_NET_LOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/lock.h" | |
14 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
15 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/synchronization/lock.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "net/base/net_log.h" | 17 #include "net/base/net_log.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 // CapturingNetLog is an implementation of NetLog that saves messages to a | 21 // CapturingNetLog is an implementation of NetLog that saves messages to a |
22 // bounded buffer. | 22 // bounded buffer. |
23 class CapturingNetLog : public NetLog { | 23 class CapturingNetLog : public NetLog { |
24 public: | 24 public: |
25 struct Entry { | 25 struct Entry { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual void AddEntry(EventType type, | 58 virtual void AddEntry(EventType type, |
59 const base::TimeTicks& time, | 59 const base::TimeTicks& time, |
60 const Source& source, | 60 const Source& source, |
61 EventPhase phase, | 61 EventPhase phase, |
62 EventParameters* extra_parameters); | 62 EventParameters* extra_parameters); |
63 virtual uint32 NextID(); | 63 virtual uint32 NextID(); |
64 virtual LogLevel GetLogLevel() const; | 64 virtual LogLevel GetLogLevel() const; |
65 | 65 |
66 private: | 66 private: |
67 // Needs to be "mutable" so can use it in GetEntries(). | 67 // Needs to be "mutable" so can use it in GetEntries(). |
68 mutable Lock lock_; | 68 mutable base::Lock lock_; |
69 | 69 |
70 // Last assigned source ID. Incremented to get the next one. | 70 // Last assigned source ID. Incremented to get the next one. |
71 base::subtle::Atomic32 last_id_; | 71 base::subtle::Atomic32 last_id_; |
72 | 72 |
73 size_t max_num_entries_; | 73 size_t max_num_entries_; |
74 EntryList entries_; | 74 EntryList entries_; |
75 | 75 |
76 NetLog::LogLevel log_level_; | 76 NetLog::LogLevel log_level_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(CapturingNetLog); | 78 DISALLOW_COPY_AND_ASSIGN(CapturingNetLog); |
(...skipping 29 matching lines...) Expand all Loading... |
108 NetLog::Source source_; | 108 NetLog::Source source_; |
109 scoped_ptr<CapturingNetLog> capturing_net_log_; | 109 scoped_ptr<CapturingNetLog> capturing_net_log_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog); | 111 DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog); |
112 }; | 112 }; |
113 | 113 |
114 } // namespace net | 114 } // namespace net |
115 | 115 |
116 #endif // NET_BASE_CAPTURING_NET_LOG_H_ | 116 #endif // NET_BASE_CAPTURING_NET_LOG_H_ |
117 | 117 |
OLD | NEW |