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

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

Issue 1129953004: Reland: Lazily initialize MessageLoop for faster thread startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix.. 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/metrics/thread_watcher_android_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 601
602 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { 602 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
603 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 603 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
604 if (!system_url_request_context_getter_.get()) { 604 if (!system_url_request_context_getter_.get()) {
605 InitSystemRequestContext(); 605 InitSystemRequestContext();
606 } 606 }
607 return system_url_request_context_getter_.get(); 607 return system_url_request_context_getter_.get();
608 } 608 }
609 609
610 void IOThread::Init() { 610 void IOThread::Init() {
611 // Prefer to use InitAsync unless you need initialization to block
612 // the UI thread
613 }
614
615 void IOThread::InitAsync() {
616 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 611 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
617 // is fixed. 612 // is fixed.
618 tracked_objects::ScopedTracker tracking_profile1( 613 tracked_objects::ScopedTracker tracking_profile1(
619 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); 614 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start"));
620 TRACE_EVENT0("startup", "IOThread::InitAsync"); 615 TRACE_EVENT0("startup", "IOThread::InitAsync");
621 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 616 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
622 617
623 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 618 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
624 net::SetMessageLoopForNSSHttpIO(); 619 net::SetMessageLoopForNSSHttpIO();
625 #endif 620 #endif
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1627 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1633 for (size_t i = 0; i < supported_versions.size(); ++i) { 1628 for (size_t i = 0; i < supported_versions.size(); ++i) {
1634 net::QuicVersion version = supported_versions[i]; 1629 net::QuicVersion version = supported_versions[i];
1635 if (net::QuicVersionToString(version) == quic_version) { 1630 if (net::QuicVersionToString(version) == quic_version) {
1636 return version; 1631 return version;
1637 } 1632 }
1638 } 1633 }
1639 1634
1640 return net::QUIC_VERSION_UNSUPPORTED; 1635 return net::QUIC_VERSION_UNSUPPORTED;
1641 } 1636 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/metrics/thread_watcher_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698