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

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 883023003: Add UMA for startup load time of component extensions. At the moment there is (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | tools/metrics/histograms/histograms.xml » ('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/extensions/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/json/json_string_value_serializer.h" 11 #include "base/json/json_string_value_serializer.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/time/time.h"
14 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/search/hotword_service.h" 16 #include "chrome/browser/search/hotword_service.h"
16 #include "chrome/browser/search/hotword_service_factory.h" 17 #include "chrome/browser/search/hotword_service_factory.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
21 #include "chrome/grit/generated_resources.h" 22 #include "chrome/grit/generated_resources.h"
22 #include "components/crx_file/id_util.h" 23 #include "components/crx_file/id_util.h"
23 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 local_state_(local_state), 118 local_state_(local_state),
118 browser_context_(browser_context), 119 browser_context_(browser_context),
119 extension_service_(extension_service), 120 extension_service_(extension_service),
120 weak_factory_(this) {} 121 weak_factory_(this) {}
121 122
122 ComponentLoader::~ComponentLoader() { 123 ComponentLoader::~ComponentLoader() {
123 ClearAllRegistered(); 124 ClearAllRegistered();
124 } 125 }
125 126
126 void ComponentLoader::LoadAll() { 127 void ComponentLoader::LoadAll() {
128 base::Time start_time = base::Time::Now();
Marijn Kruisselbrink 2015/01/28 19:13:19 Shouldn't this be base::TimeTicks::Now() just like
127 for (RegisteredComponentExtensions::iterator it = 129 for (RegisteredComponentExtensions::iterator it =
128 component_extensions_.begin(); 130 component_extensions_.begin();
129 it != component_extensions_.end(); ++it) { 131 it != component_extensions_.end(); ++it) {
130 Load(*it); 132 Load(*it);
131 } 133 }
134 UMA_HISTOGRAM_TIMES("Extensions.LoadAllComponentTime",
135 base::TimeTicks::Now() - start_time);
Mark P 2015/01/28 19:14:49 it probably would be better to use the same time f
132 } 136 }
133 137
134 base::DictionaryValue* ComponentLoader::ParseManifest( 138 base::DictionaryValue* ComponentLoader::ParseManifest(
135 const std::string& manifest_contents) const { 139 const std::string& manifest_contents) const {
136 JSONStringValueSerializer serializer(manifest_contents); 140 JSONStringValueSerializer serializer(manifest_contents);
137 scoped_ptr<base::Value> manifest(serializer.Deserialize(NULL, NULL)); 141 scoped_ptr<base::Value> manifest(serializer.Deserialize(NULL, NULL));
138 142
139 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { 143 if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) {
140 LOG(ERROR) << "Failed to parse extension manifest."; 144 LOG(ERROR) << "Failed to parse extension manifest.";
141 return NULL; 145 return NULL;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); 664 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
661 storage::FileSystemContext* file_system_context = 665 storage::FileSystemContext* file_system_context =
662 content::BrowserContext::GetStoragePartitionForSite( 666 content::BrowserContext::GetStoragePartitionForSite(
663 off_the_record_context, site)->GetFileSystemContext(); 667 off_the_record_context, site)->GetFileSystemContext();
664 file_system_context->EnableTemporaryFileSystemInIncognito(); 668 file_system_context->EnableTemporaryFileSystemInIncognito();
665 } 669 }
666 #endif 670 #endif
667 } 671 }
668 672
669 } // namespace extensions 673 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698