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

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

Issue 23007021: Report Javascript Runtime Errors to the Error Console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_feldman
Patch Set: Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/error_console/error_console.h" 5 #include "chrome/browser/extensions/error_console/error_console.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // static 62 // static
63 ErrorConsole* ErrorConsole::Get(Profile* profile) { 63 ErrorConsole* ErrorConsole::Get(Profile* profile) {
64 return ExtensionSystem::Get(profile)->error_console(); 64 return ExtensionSystem::Get(profile)->error_console();
65 } 65 }
66 66
67 void ErrorConsole::ReportError(scoped_ptr<const ExtensionError> scoped_error) { 67 void ErrorConsole::ReportError(scoped_ptr<const ExtensionError> scoped_error) {
68 DCHECK(thread_checker_.CalledOnValidThread()); 68 DCHECK(thread_checker_.CalledOnValidThread());
69 69
70 const ExtensionError* error = scoped_error.release(); 70 const ExtensionError* error = scoped_error.release();
71
72 if (!Extension::IdIsValid(error->extension_id()))
73 return;
74
71 // If there are too many errors for an extension already, limit ourselves to 75 // If there are too many errors for an extension already, limit ourselves to
72 // the most recent ones. 76 // the most recent ones.
73 ErrorList* error_list = &errors_[error->extension_id()]; 77 ErrorList* error_list = &errors_[error->extension_id()];
74 if (error_list->size() >= kMaxErrorsPerExtension) { 78 if (error_list->size() >= kMaxErrorsPerExtension) {
75 delete error_list->front(); 79 delete error_list->front();
76 error_list->pop_front(); 80 error_list->pop_front();
77 } 81 }
78 error_list->push_back(error); 82 error_list->push_back(error);
79 83
80 FOR_EACH_OBSERVER(Observer, observers_, OnErrorAdded(error)); 84 FOR_EACH_OBSERVER(Observer, observers_, OnErrorAdded(error));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // notifications from our own. 140 // notifications from our own.
137 RemoveErrorsForExtension( 141 RemoveErrorsForExtension(
138 content::Details<Extension>(details).ptr()->id()); 142 content::Details<Extension>(details).ptr()->id());
139 break; 143 break;
140 default: 144 default:
141 NOTREACHED(); 145 NOTREACHED();
142 } 146 }
143 } 147 }
144 148
145 } // namespace extensions 149 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698