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

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: StartAndWait -> StartAndWaitForTesting Created 5 years, 8 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 607
608 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { 608 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
609 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 609 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
610 if (!system_url_request_context_getter_.get()) { 610 if (!system_url_request_context_getter_.get()) {
611 InitSystemRequestContext(); 611 InitSystemRequestContext();
612 } 612 }
613 return system_url_request_context_getter_.get(); 613 return system_url_request_context_getter_.get();
614 } 614 }
615 615
616 void IOThread::Init() { 616 void IOThread::Init() {
617 // Prefer to use InitAsync unless you need initialization to block
618 // the UI thread
619 }
620
621 void IOThread::InitAsync() {
622 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 617 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
623 // is fixed. 618 // is fixed.
624 tracked_objects::ScopedTracker tracking_profile1( 619 tracked_objects::ScopedTracker tracking_profile1(
625 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); 620 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start"));
626 TRACE_EVENT0("startup", "IOThread::InitAsync"); 621 TRACE_EVENT0("startup", "IOThread::InitAsync");
627 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 622 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
628 623
629 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 624 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
630 net::SetMessageLoopForNSSHttpIO(); 625 net::SetMessageLoopForNSSHttpIO();
631 #endif 626 #endif
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1595 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1601 for (size_t i = 0; i < supported_versions.size(); ++i) { 1596 for (size_t i = 0; i < supported_versions.size(); ++i) {
1602 net::QuicVersion version = supported_versions[i]; 1597 net::QuicVersion version = supported_versions[i];
1603 if (net::QuicVersionToString(version) == quic_version) { 1598 if (net::QuicVersionToString(version) == quic_version) {
1604 return version; 1599 return version;
1605 } 1600 }
1606 } 1601 }
1607 1602
1608 return net::QUIC_VERSION_UNSUPPORTED; 1603 return net::QUIC_VERSION_UNSUPPORTED;
1609 } 1604 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698