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

Side by Side Diff: net/base/net_log_util.cc

Issue 879383004: Workaround for chrome://net-internals debug crash on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/base/net_log_util.h" 5 #include "net/base/net_log_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 NetLog::ThreadSafeObserver* observer) { 530 NetLog::ThreadSafeObserver* observer) {
531 // Not safe to call this when the observer is watching a NetLog. 531 // Not safe to call this when the observer is watching a NetLog.
532 DCHECK(!observer->net_log()); 532 DCHECK(!observer->net_log());
533 533
534 // Put together the list of all requests. 534 // Put together the list of all requests.
535 std::vector<const URLRequest*> requests; 535 std::vector<const URLRequest*> requests;
536 for (const auto& context : contexts) { 536 for (const auto& context : contexts) {
537 // May only be called on the context's thread. 537 // May only be called on the context's thread.
538 DCHECK(context->CalledOnValidThread()); 538 DCHECK(context->CalledOnValidThread());
539 // Contexts should all be using the same NetLog. 539 // Contexts should all be using the same NetLog.
540 DCHECK_EQ((*contexts.begin())->net_log(), context->net_log()); 540 // TODO(mmenke) This DCHECK fails on Android.
jeremyim 2015/01/28 22:12:04 Alternatively, this could be wrapped with #if !de
541 // DCHECK_EQ((*contexts.begin())->net_log(), context->net_log());
mmenke 2015/01/30 15:17:14 Outputting requests from two different NetLogs (Or
jeremyim 2015/01/30 15:48:07 Done.
541 for (const auto& request : *context->url_requests()) { 542 for (const auto& request : *context->url_requests()) {
542 requests.push_back(request); 543 requests.push_back(request);
543 } 544 }
544 } 545 }
545 546
546 // Sort by creation time. 547 // Sort by creation time.
547 std::sort(requests.begin(), requests.end(), RequestCreatedBefore); 548 std::sort(requests.begin(), requests.end(), RequestCreatedBefore);
548 549
549 // Create fake events. 550 // Create fake events.
550 ScopedVector<NetLog::Entry> entries; 551 ScopedVector<NetLog::Entry> entries;
551 for (const auto& request : requests) { 552 for (const auto& request : requests) {
552 net::NetLog::ParametersCallback callback = 553 net::NetLog::ParametersCallback callback =
553 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); 554 base::Bind(&GetRequestStateAsValue, base::Unretained(request));
554 555
555 net::NetLog::EntryData entry_data(net::NetLog::TYPE_REQUEST_ALIVE, 556 net::NetLog::EntryData entry_data(net::NetLog::TYPE_REQUEST_ALIVE,
556 request->net_log().source(), 557 request->net_log().source(),
557 net::NetLog::PHASE_BEGIN, 558 net::NetLog::PHASE_BEGIN,
558 request->creation_time(), 559 request->creation_time(),
559 &callback); 560 &callback);
560 NetLog::Entry entry(&entry_data, request->net_log().GetLogLevel()); 561 NetLog::Entry entry(&entry_data, request->net_log().GetLogLevel());
561 observer->OnAddEntry(entry); 562 observer->OnAddEntry(entry);
562 } 563 }
563 } 564 }
564 565
565 } // namespace net 566 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698