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

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

Powered by Google App Engine
This is Rietveld 408576698