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

Unified Diff: remoting/host/vlog_net_log.cc

Issue 16137008: Refactor net::NetLog to provide implementation of observer pattern, not just the interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/vlog_net_log.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/vlog_net_log.cc
diff --git a/remoting/host/vlog_net_log.cc b/remoting/host/vlog_net_log.cc
index 05e9a3513b14c65f8e38da89e82964b50b0346a4..2e2e43607debbf223893a0dd194af6220e8f7982 100644
--- a/remoting/host/vlog_net_log.cc
+++ b/remoting/host/vlog_net_log.cc
@@ -13,13 +13,25 @@
namespace remoting {
-VlogNetLog::VlogNetLog() : id_(0) {
+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() {
+VlogNetLog::Observer::~Observer() {
}
-void VlogNetLog::OnAddEntry(const NetLog::Entry& entry) {
+void VlogNetLog::Observer::OnAddEntry(const net::NetLog::Entry& entry) {
if (VLOG_IS_ON(4)) {
scoped_ptr<Value> value(entry.ToValue());
std::string json;
@@ -28,27 +40,13 @@ void VlogNetLog::OnAddEntry(const NetLog::Entry& entry) {
}
}
-uint32 VlogNetLog::NextID() {
- // TODO(mmenke): Make this threadsafe and start with 1 instead of 0.
- return id_++;
-}
-
-net::NetLog::LogLevel VlogNetLog::GetLogLevel() const {
- return LOG_ALL_BUT_BYTES;
+VlogNetLog::VlogNetLog()
+ : observer_(new Observer()) {
+ AddThreadSafeObserver(observer_.get(), 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();
+VlogNetLog::~VlogNetLog() {
+ RemoveThreadSafeObserver(observer_.get());
}
} // namespace remoting
« no previous file with comments | « remoting/host/vlog_net_log.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698