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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 1011683002: Lazily initialize MessageLoop for faster thread startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 605
606 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { 606 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
608 if (!system_url_request_context_getter_.get()) { 608 if (!system_url_request_context_getter_.get()) {
609 InitSystemRequestContext(); 609 InitSystemRequestContext();
610 } 610 }
611 return system_url_request_context_getter_.get(); 611 return system_url_request_context_getter_.get();
612 } 612 }
613 613
614 void IOThread::Init() { 614 void IOThread::Init() {
615 // Prefer to use InitAsync unless you need initialization to block
616 // the UI thread
617 }
618
619 void IOThread::InitAsync() {
620 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 615 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
621 // is fixed. 616 // is fixed.
622 tracked_objects::ScopedTracker tracking_profile1( 617 tracked_objects::ScopedTracker tracking_profile1(
623 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); 618 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start"));
624 TRACE_EVENT0("startup", "IOThread::InitAsync"); 619 TRACE_EVENT0("startup", "IOThread::InitAsync");
625 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
626 621
627 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 622 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
628 net::SetMessageLoopForNSSHttpIO(); 623 net::SetMessageLoopForNSSHttpIO();
629 #endif 624 #endif
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1626 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1632 for (size_t i = 0; i < supported_versions.size(); ++i) { 1627 for (size_t i = 0; i < supported_versions.size(); ++i) {
1633 net::QuicVersion version = supported_versions[i]; 1628 net::QuicVersion version = supported_versions[i];
1634 if (net::QuicVersionToString(version) == quic_version) { 1629 if (net::QuicVersionToString(version) == quic_version) {
1635 return version; 1630 return version;
1636 } 1631 }
1637 } 1632 }
1638 1633
1639 return net::QUIC_VERSION_UNSUPPORTED; 1634 return net::QUIC_VERSION_UNSUPPORTED;
1640 } 1635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698