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

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

Issue 612023003: Make --log-net-log and NetLogLogger hide cookies by default, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new test Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_NET_LOG_H_ 5 #ifndef NET_BASE_NET_LOG_H_
6 #define NET_BASE_NET_LOG_H_ 6 #define NET_BASE_NET_LOG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // |value| as a pointer to avoid copying, and emphasize it must be valid for 293 // |value| as a pointer to avoid copying, and emphasize it must be valid for
294 // the life of the callback. |value| may not be NULL. 294 // the life of the callback. |value| may not be NULL.
295 // Warning: |name| and |value| must remain valid for the life of the callback. 295 // Warning: |name| and |value| must remain valid for the life of the callback.
296 static ParametersCallback StringCallback(const char* name, 296 static ParametersCallback StringCallback(const char* name,
297 const std::string* value); 297 const std::string* value);
298 298
299 // Same as above, but takes in a UTF16 string. 299 // Same as above, but takes in a UTF16 string.
300 static ParametersCallback StringCallback(const char* name, 300 static ParametersCallback StringCallback(const char* name,
301 const base::string16* value); 301 const base::string16* value);
302 302
303 protected:
304 // Set the lowest allowed log level, regardless of any Observers.
305 void SetBaseLogLevel(LogLevel log_level);
306
307 private: 303 private:
308 friend class BoundNetLog; 304 friend class BoundNetLog;
309 305
310 void AddEntry(EventType type, 306 void AddEntry(EventType type,
311 const Source& source, 307 const Source& source,
312 EventPhase phase, 308 EventPhase phase,
313 const NetLog::ParametersCallback* parameters_callback); 309 const NetLog::ParametersCallback* parameters_callback);
314 310
315 // Called whenever an observer is added or removed, or has its log level 311 // Called whenever an observer is added or removed, or has its log level
316 // changed. Must have acquired |lock_| prior to calling. 312 // changed. Must have acquired |lock_| prior to calling.
317 void UpdateLogLevel(); 313 void UpdateLogLevel();
318 314
319 // |lock_| protects access to |observers_|. 315 // |lock_| protects access to |observers_|.
320 base::Lock lock_; 316 base::Lock lock_;
321 317
322 // Last assigned source ID. Incremented to get the next one. 318 // Last assigned source ID. Incremented to get the next one.
323 base::subtle::Atomic32 last_id_; 319 base::subtle::Atomic32 last_id_;
324 320
325 // The lowest allowed log level, regardless of any Observers.
326 // Normally defaults to LOG_NONE, but can be changed with SetBaseLogLevel
327 LogLevel base_log_level_;
328
329 // The current log level. 321 // The current log level.
330 base::subtle::Atomic32 effective_log_level_; 322 base::subtle::Atomic32 effective_log_level_;
331 323
332 // |lock_| must be acquired whenever reading or writing to this. 324 // |lock_| must be acquired whenever reading or writing to this.
333 ObserverList<ThreadSafeObserver, true> observers_; 325 ObserverList<ThreadSafeObserver, true> observers_;
334 326
335 DISALLOW_COPY_AND_ASSIGN(NetLog); 327 DISALLOW_COPY_AND_ASSIGN(NetLog);
336 }; 328 };
337 329
338 // Helper that binds a Source to a NetLog, and exposes convenience methods to 330 // Helper that binds a Source to a NetLog, and exposes convenience methods to
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 : source_(source), net_log_(net_log) { 392 : source_(source), net_log_(net_log) {
401 } 393 }
402 394
403 NetLog::Source source_; 395 NetLog::Source source_;
404 NetLog* net_log_; 396 NetLog* net_log_;
405 }; 397 };
406 398
407 } // namespace net 399 } // namespace net
408 400
409 #endif // NET_BASE_NET_LOG_H_ 401 #endif // NET_BASE_NET_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698