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

Side by Side Diff: content/browser/debugger/devtools_netlog_observer.cc

Issue 9113079: DevTools: refactor remote debugging server to enable content_shell debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing. Created 8 years, 10 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 #include "content/browser/debugger/devtools_netlog_observer.h" 5 #include "content/browser/debugger/devtools_netlog_observer.h"
6 6
7 #include "base/string_tokenizer.h" 7 #include "base/string_tokenizer.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 DictionaryValue* dValue = static_cast<DictionaryValue*>(value.get()); 233 DictionaryValue* dValue = static_cast<DictionaryValue*>(value.get());
234 if (!dValue->GetInteger("byte_count", &byte_count)) 234 if (!dValue->GetInteger("byte_count", &byte_count))
235 return; 235 return;
236 236
237 encoded_data_length_it->second += byte_count; 237 encoded_data_length_it->second += byte_count;
238 } 238 }
239 } 239 }
240 240
241 void DevToolsNetLogObserver::Attach() { 241 void DevToolsNetLogObserver::Attach() {
242 DCHECK(!instance_); 242 DCHECK(!instance_);
243 243 net::NetLog* net_log = content::GetContentClient()->browser()->GetNetLog();
244 instance_ = new DevToolsNetLogObserver( 244 if (net_log)
245 content::GetContentClient()->browser()->GetNetLog()); 245 instance_ = new DevToolsNetLogObserver(net_log);
246 } 246 }
247 247
248 void DevToolsNetLogObserver::Detach() { 248 void DevToolsNetLogObserver::Detach() {
249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
250 DCHECK(instance_);
251 250
252 delete instance_; 251 if (instance_) {
253 instance_ = NULL; 252 delete instance_;
253 instance_ = NULL;
254 }
254 } 255 }
255 256
256 DevToolsNetLogObserver* DevToolsNetLogObserver::GetInstance() { 257 DevToolsNetLogObserver* DevToolsNetLogObserver::GetInstance() {
257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
258 259
259 return instance_; 260 return instance_;
260 } 261 }
261 262
262 // static 263 // static
263 void DevToolsNetLogObserver::PopulateResponseInfo( 264 void DevToolsNetLogObserver::PopulateResponseInfo(
(...skipping 25 matching lines...) Expand all
289 290
290 RequestToEncodedDataLengthMap::iterator it = 291 RequestToEncodedDataLengthMap::iterator it =
291 dev_tools_net_log_observer->request_to_encoded_data_length_.find( 292 dev_tools_net_log_observer->request_to_encoded_data_length_.find(
292 source_id); 293 source_id);
293 if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end()) 294 if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end())
294 return -1; 295 return -1;
295 int encoded_data_length = it->second; 296 int encoded_data_length = it->second;
296 it->second = 0; 297 it->second = 0;
297 return encoded_data_length; 298 return encoded_data_length;
298 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698