| Index: net/base/capturing_net_log.cc
|
| diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc
|
| index b90dcae4f860d77ea6fe03bfd910bb5a4a2c8d92..f938931518aea28c320a03c977f3ed19a6e81724 100644
|
| --- a/net/base/capturing_net_log.cc
|
| +++ b/net/base/capturing_net_log.cc
|
| @@ -67,20 +67,19 @@ std::string CapturingNetLog::CapturedEntry::GetParamsJson() const {
|
| return json;
|
| }
|
|
|
| -CapturingNetLog::CapturingNetLog()
|
| - : last_id_(0),
|
| - log_level_(LOG_ALL_BUT_BYTES) {
|
| -}
|
| +CapturingNetLog::Observer::Observer() {}
|
|
|
| -CapturingNetLog::~CapturingNetLog() {}
|
| +CapturingNetLog::Observer::~Observer() {}
|
|
|
| -void CapturingNetLog::GetEntries(CapturedEntryList* entry_list) const {
|
| +void CapturingNetLog::Observer::GetEntries(
|
| + CapturedEntryList* entry_list) const {
|
| base::AutoLock lock(lock_);
|
| *entry_list = captured_entries_;
|
| }
|
|
|
| -void CapturingNetLog::GetEntriesForSource(NetLog::Source source,
|
| - CapturedEntryList* entry_list) const {
|
| +void CapturingNetLog::Observer::GetEntriesForSource(
|
| + NetLog::Source source,
|
| + CapturedEntryList* entry_list) const {
|
| base::AutoLock lock(lock_);
|
| entry_list->clear();
|
| for (CapturedEntryList::const_iterator entry = captured_entries_.begin();
|
| @@ -90,22 +89,17 @@ void CapturingNetLog::GetEntriesForSource(NetLog::Source source,
|
| }
|
| }
|
|
|
| -size_t CapturingNetLog::GetSize() const {
|
| +size_t CapturingNetLog::Observer::GetSize() const {
|
| base::AutoLock lock(lock_);
|
| return captured_entries_.size();
|
| }
|
|
|
| -void CapturingNetLog::Clear() {
|
| +void CapturingNetLog::Observer::Clear() {
|
| base::AutoLock lock(lock_);
|
| captured_entries_.clear();
|
| }
|
|
|
| -void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
|
| - base::AutoLock lock(lock_);
|
| - log_level_ = log_level;
|
| -}
|
| -
|
| -void CapturingNetLog::OnAddEntry(const net::NetLog::Entry& entry) {
|
| +void CapturingNetLog::Observer::OnAddEntry(const net::NetLog::Entry& entry) {
|
| // Only BoundNetLogs without a NetLog should have an invalid source.
|
| CHECK(entry.source().IsValid());
|
|
|
| @@ -126,29 +120,35 @@ void CapturingNetLog::OnAddEntry(const net::NetLog::Entry& entry) {
|
| scoped_ptr<DictionaryValue>(param_dict)));
|
| }
|
|
|
| -uint32 CapturingNetLog::NextID() {
|
| - return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1);
|
| +CapturingNetLog::CapturingNetLog() {
|
| + AddThreadSafeObserver(&capturing_net_log_observer_, LOG_ALL_BUT_BYTES);
|
| }
|
|
|
| -NetLog::LogLevel CapturingNetLog::GetLogLevel() const {
|
| - base::AutoLock lock(lock_);
|
| - return log_level_;
|
| +CapturingNetLog::~CapturingNetLog() {
|
| + RemoveThreadSafeObserver(&capturing_net_log_observer_);
|
| }
|
|
|
| -void CapturingNetLog::AddThreadSafeObserver(
|
| - NetLog::ThreadSafeObserver* observer,
|
| - NetLog::LogLevel log_level) {
|
| - NOTIMPLEMENTED() << "Not currently used by net unit tests.";
|
| +void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
|
| + SetObserverLogLevel(&capturing_net_log_observer_, log_level);
|
| }
|
|
|
| -void CapturingNetLog::SetObserverLogLevel(ThreadSafeObserver* observer,
|
| - LogLevel log_level) {
|
| - NOTIMPLEMENTED() << "Not currently used by net unit tests.";
|
| +void CapturingNetLog::GetEntries(
|
| + CapturingNetLog::CapturedEntryList* entry_list) const {
|
| + capturing_net_log_observer_.GetEntries(entry_list);
|
| +}
|
| +
|
| +void CapturingNetLog::GetEntriesForSource(
|
| + NetLog::Source source,
|
| + CapturedEntryList* entry_list) const {
|
| + capturing_net_log_observer_.GetEntriesForSource(source, entry_list);
|
| }
|
|
|
| -void CapturingNetLog::RemoveThreadSafeObserver(
|
| - NetLog::ThreadSafeObserver* observer) {
|
| - NOTIMPLEMENTED() << "Not currently used by net unit tests.";
|
| +size_t CapturingNetLog::GetSize() const {
|
| + return capturing_net_log_observer_.GetSize();
|
| +}
|
| +
|
| +void CapturingNetLog::Clear() {
|
| + capturing_net_log_observer_.Clear();
|
| }
|
|
|
| CapturingBoundNetLog::CapturingBoundNetLog()
|
|
|