diff options
author | kouhei@chromium.org <kouhei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-07 19:18:26 +0000 |
---|---|---|
committer | kouhei@chromium.org <kouhei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-07 19:18:26 +0000 |
commit | 1cf7fd079ca5d2638c816e91bd4b50bed915eba0 (patch) | |
tree | a55a4f4e6fd0a72669ddae31da738e62301ddb1d /remoting/host | |
parent | 89a94a7913b6bbc6eb2ad9510b82a519bce2bd61 (diff) | |
download | chromium_src-1cf7fd079ca5d2638c816e91bd4b50bed915eba0.zip chromium_src-1cf7fd079ca5d2638c816e91bd4b50bed915eba0.tar.gz chromium_src-1cf7fd079ca5d2638c816e91bd4b50bed915eba0.tar.bz2 |
Revert 204861 "Refactor net::NetLog to provide implementation of..."
> Refactor net::NetLog to provide implementation of observer pattern, not just the interface.
> This would make use of net::NetLog::ThreadSafeObserver available from base/net, so custom NetLog implementations can focus on implementing OnAddEntry() without re-implementing all NetLog methods.
>
> The implementation of observer pattern was previously provided in ChromeNetLog.
> The contents of chrome_net_log_unittest are merged to net_log_unittest.
>
> TESTS=net_log_unittest
> BUG=None
>
> Review URL: https://chromiumcodereview.appspot.com/16137008
TBR=kouhei@chromium.org
Review URL: https://codereview.chromium.org/15927035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/vlog_net_log.cc | 42 | ||||
-rw-r--r-- | remoting/host/vlog_net_log.h | 14 |
2 files changed, 33 insertions, 23 deletions
diff --git a/remoting/host/vlog_net_log.cc b/remoting/host/vlog_net_log.cc index 2e2e436..05e9a35 100644 --- a/remoting/host/vlog_net_log.cc +++ b/remoting/host/vlog_net_log.cc @@ -13,25 +13,13 @@ namespace remoting { -class VlogNetLog::Observer : public net::NetLog::ThreadSafeObserver { - public: - Observer(); - virtual ~Observer(); - - // NetLog::ThreadSafeObserver overrides: - virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(Observer); -}; - -VlogNetLog::Observer::Observer() { +VlogNetLog::VlogNetLog() : id_(0) { } -VlogNetLog::Observer::~Observer() { +VlogNetLog::~VlogNetLog() { } -void VlogNetLog::Observer::OnAddEntry(const net::NetLog::Entry& entry) { +void VlogNetLog::OnAddEntry(const NetLog::Entry& entry) { if (VLOG_IS_ON(4)) { scoped_ptr<Value> value(entry.ToValue()); std::string json; @@ -40,13 +28,27 @@ void VlogNetLog::Observer::OnAddEntry(const net::NetLog::Entry& entry) { } } -VlogNetLog::VlogNetLog() - : observer_(new Observer()) { - AddThreadSafeObserver(observer_.get(), LOG_ALL_BUT_BYTES); +uint32 VlogNetLog::NextID() { + // TODO(mmenke): Make this threadsafe and start with 1 instead of 0. + return id_++; } -VlogNetLog::~VlogNetLog() { - RemoveThreadSafeObserver(observer_.get()); +net::NetLog::LogLevel VlogNetLog::GetLogLevel() const { + return LOG_ALL_BUT_BYTES; +} + +void VlogNetLog::AddThreadSafeObserver(ThreadSafeObserver* observer, + net::NetLog::LogLevel log_level) { + NOTIMPLEMENTED(); +} + +void VlogNetLog::SetObserverLogLevel(ThreadSafeObserver* observer, + net::NetLog::LogLevel log_level) { + NOTIMPLEMENTED(); +} + +void VlogNetLog::RemoveThreadSafeObserver(ThreadSafeObserver* observer) { + NOTIMPLEMENTED(); } } // namespace remoting diff --git a/remoting/host/vlog_net_log.h b/remoting/host/vlog_net_log.h index 393ab1c..d056a3a 100644 --- a/remoting/host/vlog_net_log.h +++ b/remoting/host/vlog_net_log.h @@ -6,7 +6,6 @@ #define REMOTING_HOST_VLOG_NET_LOG_H_ #include "base/memory/scoped_handle.h" -#include "base/memory/scoped_ptr.h" #include "net/base/net_log.h" namespace remoting { @@ -20,9 +19,18 @@ class VlogNetLog : public net::NetLog { VlogNetLog(); virtual ~VlogNetLog(); + // NetLog overrides: + virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE; + virtual uint32 NextID() OVERRIDE; + virtual LogLevel GetLogLevel() const OVERRIDE; + virtual void AddThreadSafeObserver(ThreadSafeObserver* observer, + LogLevel log_level) OVERRIDE; + virtual void SetObserverLogLevel(ThreadSafeObserver* observer, + LogLevel log_level) OVERRIDE; + virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE; + private: - class Observer; - scoped_ptr<Observer> observer_; + uint32 id_; DISALLOW_COPY_AND_ASSIGN(VlogNetLog); }; |