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

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

Issue 947673002: Get more useful LOG(FATAL) messages from ExtensionSyncData to help diagnose crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@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 | no next file » | 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/extension_sync_data.h" 5 #include "chrome/browser/extensions/extension_sync_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/extensions/app_sync_data.h" 8 #include "chrome/browser/extensions/app_sync_data.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "components/crx_file/id_util.h" 10 #include "components/crx_file/id_util.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 specifics->set_remote_install(remote_install_); 89 specifics->set_remote_install(remote_install_);
90 if (all_urls_enabled_ != BOOLEAN_UNSET) 90 if (all_urls_enabled_ != BOOLEAN_UNSET)
91 specifics->set_all_urls_enabled(all_urls_enabled_ == BOOLEAN_TRUE); 91 specifics->set_all_urls_enabled(all_urls_enabled_ == BOOLEAN_TRUE);
92 specifics->set_installed_by_custodian(installed_by_custodian_); 92 specifics->set_installed_by_custodian(installed_by_custodian_);
93 specifics->set_name(name_); 93 specifics->set_name(name_);
94 } 94 }
95 95
96 void ExtensionSyncData::PopulateFromExtensionSpecifics( 96 void ExtensionSyncData::PopulateFromExtensionSpecifics(
97 const sync_pb::ExtensionSpecifics& specifics) { 97 const sync_pb::ExtensionSpecifics& specifics) {
98 if (!crx_file::id_util::IdIsValid(specifics.id())) { 98 if (!crx_file::id_util::IdIsValid(specifics.id())) {
99 LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics."; 99 LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics: bad ID "
100 << specifics.id() << ".";
Devlin 2015/02/21 17:33:35 If it was me, I'd probably make a LogExtensionSpec
100 } 101 }
101 102
102 Version specifics_version(specifics.version()); 103 Version specifics_version(specifics.version());
103 if (!specifics_version.IsValid()) 104 if (!specifics_version.IsValid())
104 LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics."; 105 LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics: bad version "
106 << specifics.version() << ".";
105 107
106 // The update URL must be either empty or valid. 108 // The update URL must be either empty or valid.
107 GURL specifics_update_url(specifics.update_url()); 109 GURL specifics_update_url(specifics.update_url());
108 if (!specifics_update_url.is_empty() && !specifics_update_url.is_valid()) { 110 if (!specifics_update_url.is_empty() && !specifics_update_url.is_valid()) {
109 LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics."; 111 LOG(FATAL) << "Attempt to sync bad ExtensionSpecifics: bad update URL "
112 << specifics.update_url() << ".";
110 } 113 }
111 114
112 id_ = specifics.id(); 115 id_ = specifics.id();
113 update_url_ = specifics_update_url; 116 update_url_ = specifics_update_url;
114 version_ = specifics_version; 117 version_ = specifics_version;
115 enabled_ = specifics.enabled(); 118 enabled_ = specifics.enabled();
116 incognito_enabled_ = specifics.incognito_enabled(); 119 incognito_enabled_ = specifics.incognito_enabled();
117 if (specifics.has_all_urls_enabled()) { 120 if (specifics.has_all_urls_enabled()) {
118 all_urls_enabled_ = 121 all_urls_enabled_ =
119 specifics.all_urls_enabled() ? BOOLEAN_TRUE : BOOLEAN_FALSE; 122 specifics.all_urls_enabled() ? BOOLEAN_TRUE : BOOLEAN_FALSE;
(...skipping 16 matching lines...) Expand all
136 const sync_pb::EntitySpecifics& entity_specifics = sync_data.GetSpecifics(); 139 const sync_pb::EntitySpecifics& entity_specifics = sync_data.GetSpecifics();
137 140
138 if (entity_specifics.has_extension()) { 141 if (entity_specifics.has_extension()) {
139 PopulateFromExtensionSpecifics(entity_specifics.extension()); 142 PopulateFromExtensionSpecifics(entity_specifics.extension());
140 } else { 143 } else {
141 LOG(FATAL) << "Attempt to sync bad EntitySpecifics."; 144 LOG(FATAL) << "Attempt to sync bad EntitySpecifics.";
142 } 145 }
143 } 146 }
144 147
145 } // namespace extensions 148 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698