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

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: non-blocking thread_id() Created 5 years, 9 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() { 544 net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
546 if (!system_url_request_context_getter_.get()) { 546 if (!system_url_request_context_getter_.get()) {
547 InitSystemRequestContext(); 547 InitSystemRequestContext();
548 } 548 }
549 return system_url_request_context_getter_.get(); 549 return system_url_request_context_getter_.get();
550 } 550 }
551 551
552 void IOThread::Init() { 552 void IOThread::Init() {
553 // Prefer to use InitAsync unless you need initialization to block
554 // the UI thread
555 }
556
557 void IOThread::InitAsync() {
558 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 553 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
559 // is fixed. 554 // is fixed.
560 tracked_objects::ScopedTracker tracking_profile1( 555 tracked_objects::ScopedTracker tracking_profile1(
561 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start")); 556 FROM_HERE_WITH_EXPLICIT_FUNCTION("466432 IOThread::InitAsync::Start"));
562 TRACE_EVENT0("startup", "IOThread::InitAsync"); 557 TRACE_EVENT0("startup", "IOThread::InitAsync");
563 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 558 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
564 559
565 #if defined(USE_NSS) || defined(OS_IOS) 560 #if defined(USE_NSS) || defined(OS_IOS)
566 net::SetMessageLoopForNSSHttpIO(); 561 net::SetMessageLoopForNSSHttpIO();
567 #endif 562 #endif
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1509 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1515 for (size_t i = 0; i < supported_versions.size(); ++i) { 1510 for (size_t i = 0; i < supported_versions.size(); ++i) {
1516 net::QuicVersion version = supported_versions[i]; 1511 net::QuicVersion version = supported_versions[i];
1517 if (net::QuicVersionToString(version) == quic_version) { 1512 if (net::QuicVersionToString(version) == quic_version) {
1518 return version; 1513 return version;
1519 } 1514 }
1520 } 1515 }
1521 1516
1522 return net::QUIC_VERSION_UNSUPPORTED; 1517 return net::QUIC_VERSION_UNSUPPORTED;
1523 } 1518 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698