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

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: rebase 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_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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { 613 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
614 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 614 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
615 if (!system_url_request_context_getter_.get()) { 615 if (!system_url_request_context_getter_.get()) {
616 InitSystemRequestContext(); 616 InitSystemRequestContext();
617 } 617 }
618 return system_url_request_context_getter_.get(); 618 return system_url_request_context_getter_.get();
619 } 619 }
620 620
621 void IOThread::Init() { 621 void IOThread::Init() {
622 // Prefer to use InitAsync unless you need initialization to block
623 // the UI thread
624 }
625
626 void IOThread::InitAsync() {
627 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 622 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
628 // is fixed. 623 // is fixed.
629 tracked_objects::ScopedTracker tracking_profile1( 624 tracked_objects::ScopedTracker tracking_profile1(
630 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); 625 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start"));
631 TRACE_EVENT0("startup", "IOThread::InitAsync"); 626 TRACE_EVENT0("startup", "IOThread::InitAsync");
632 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 627 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
633 628
634 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 629 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
635 net::SetMessageLoopForNSSHttpIO(); 630 net::SetMessageLoopForNSSHttpIO();
636 #endif 631 #endif
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1639 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1645 for (size_t i = 0; i < supported_versions.size(); ++i) { 1640 for (size_t i = 0; i < supported_versions.size(); ++i) {
1646 net::QuicVersion version = supported_versions[i]; 1641 net::QuicVersion version = supported_versions[i];
1647 if (net::QuicVersionToString(version) == quic_version) { 1642 if (net::QuicVersionToString(version) == quic_version) {
1648 return version; 1643 return version;
1649 } 1644 }
1650 } 1645 }
1651 1646
1652 return net::QUIC_VERSION_UNSUPPORTED; 1647 return net::QUIC_VERSION_UNSUPPORTED;
1653 } 1648 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/metrics/thread_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698