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

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

Issue 2295023002: Delay WebUSB initialization until after browser startup. (Closed)
Patch Set: Add UMA for WebUSB detector initialization time. Created 4 years, 3 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 | « no previous file | chrome/browser/usb/web_usb_detector.h » ('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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 // Set up a task to delete old WebRTC log files for all profiles. Use a delay 1525 // Set up a task to delete old WebRTC log files for all profiles. Use a delay
1526 // to reduce the impact on startup time. 1526 // to reduce the impact on startup time.
1527 BrowserThread::PostDelayedTask( 1527 BrowserThread::PostDelayedTask(
1528 BrowserThread::UI, 1528 BrowserThread::UI,
1529 FROM_HERE, 1529 FROM_HERE,
1530 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), 1530 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles),
1531 base::TimeDelta::FromMinutes(1)); 1531 base::TimeDelta::FromMinutes(1));
1532 #endif // defined(ENABLE_WEBRTC) 1532 #endif // defined(ENABLE_WEBRTC)
1533 1533
1534 #if !defined(OS_ANDROID) 1534 #if !defined(OS_ANDROID)
1535 if (base::FeatureList::IsEnabled(features::kWebUsb)) 1535 if (base::FeatureList::IsEnabled(features::kWebUsb)) {
1536 web_usb_detector_.reset(new WebUsbDetector()); 1536 web_usb_detector_.reset(new WebUsbDetector());
1537 BrowserThread::PostAfterStartupTask(
1538 FROM_HERE, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
1539 base::Bind(&WebUsbDetector::Initialize,
1540 base::Unretained(web_usb_detector_.get())));
1541 }
1537 #endif 1542 #endif
1538 1543
1539 // At this point, StartupBrowserCreator::Start has run creating initial 1544 // At this point, StartupBrowserCreator::Start has run creating initial
1540 // browser windows and tabs, but no progress has been made in loading 1545 // browser windows and tabs, but no progress has been made in loading
1541 // content as the main message loop hasn't started processing tasks yet. 1546 // content as the main message loop hasn't started processing tasks yet.
1542 // We setup to observe to the initial page load here to defer running 1547 // We setup to observe to the initial page load here to defer running
1543 // task posted via PostAfterStartupTask until its complete. 1548 // task posted via PostAfterStartupTask until its complete.
1544 AfterStartupTaskUtils::StartMonitoringStartup(); 1549 AfterStartupTaskUtils::StartMonitoringStartup();
1545 } 1550 }
1546 1551
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 chromeos::CrosSettings::Shutdown(); 2233 chromeos::CrosSettings::Shutdown();
2229 #endif // defined(OS_CHROMEOS) 2234 #endif // defined(OS_CHROMEOS)
2230 #endif // defined(OS_ANDROID) 2235 #endif // defined(OS_ANDROID)
2231 } 2236 }
2232 2237
2233 // Public members: 2238 // Public members:
2234 2239
2235 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2240 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2236 chrome_extra_parts_.push_back(parts); 2241 chrome_extra_parts_.push_back(parts);
2237 } 2242 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/usb/web_usb_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698