Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Side by Side Diff: net/base/capturing_net_log.h

Issue 6969077: net: Add NET_API to net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "net/base/net_api.h"
17 #include "net/base/net_log.h" 18 #include "net/base/net_log.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 // CapturingNetLog is an implementation of NetLog that saves messages to a 22 // CapturingNetLog is an implementation of NetLog that saves messages to a
22 // bounded buffer. 23 // bounded buffer.
23 class CapturingNetLog : public NetLog { 24 class NET_API CapturingNetLog : public NetLog {
24 public: 25 public:
25 struct Entry { 26 struct NET_API Entry {
26 Entry(EventType type, 27 Entry(EventType type,
27 const base::TimeTicks& time, 28 const base::TimeTicks& time,
28 Source source, 29 Source source,
29 EventPhase phase, 30 EventPhase phase,
30 EventParameters* extra_parameters); 31 EventParameters* extra_parameters);
31 ~Entry(); 32 ~Entry();
32 33
33 EventType type; 34 EventType type;
34 base::TimeTicks time; 35 base::TimeTicks time;
35 Source source; 36 Source source;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 NetLog::LogLevel log_level_; 77 NetLog::LogLevel log_level_;
77 78
78 DISALLOW_COPY_AND_ASSIGN(CapturingNetLog); 79 DISALLOW_COPY_AND_ASSIGN(CapturingNetLog);
79 }; 80 };
80 81
81 // Helper class that exposes a similar API as BoundNetLog, but uses a 82 // Helper class that exposes a similar API as BoundNetLog, but uses a
82 // CapturingNetLog rather than the more generic NetLog. 83 // CapturingNetLog rather than the more generic NetLog.
83 // 84 //
84 // CapturingBoundNetLog can easily be converted to a BoundNetLog using the 85 // CapturingBoundNetLog can easily be converted to a BoundNetLog using the
85 // bound() method. 86 // bound() method.
86 class CapturingBoundNetLog { 87 class NET_TEST CapturingBoundNetLog {
87 public: 88 public:
88 CapturingBoundNetLog(const NetLog::Source& source, CapturingNetLog* net_log); 89 CapturingBoundNetLog(const NetLog::Source& source, CapturingNetLog* net_log);
89 90
90 explicit CapturingBoundNetLog(size_t max_num_entries); 91 explicit CapturingBoundNetLog(size_t max_num_entries);
91 92
92 ~CapturingBoundNetLog(); 93 ~CapturingBoundNetLog();
93 94
94 // The returned BoundNetLog is only valid while |this| is alive. 95 // The returned BoundNetLog is only valid while |this| is alive.
95 BoundNetLog bound() const { 96 BoundNetLog bound() const {
96 return BoundNetLog(source_, capturing_net_log_.get()); 97 return BoundNetLog(source_, capturing_net_log_.get());
(...skipping 11 matching lines...) Expand all
108 NetLog::Source source_; 109 NetLog::Source source_;
109 scoped_ptr<CapturingNetLog> capturing_net_log_; 110 scoped_ptr<CapturingNetLog> capturing_net_log_;
110 111
111 DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog); 112 DISALLOW_COPY_AND_ASSIGN(CapturingBoundNetLog);
112 }; 113 };
113 114
114 } // namespace net 115 } // namespace net
115 116
116 #endif // NET_BASE_CAPTURING_NET_LOG_H_ 117 #endif // NET_BASE_CAPTURING_NET_LOG_H_
117 118
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698