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

Side by Side Diff: extensions/browser/extension_host.cc

Issue 1009583004: Add UMA histograms and logging for bad IPC message handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: actions.xml claims to be pretty printed 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/extension_host.h" 5 #include "extensions/browser/extension_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/public/browser/browser_context.h" 13 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/content_browser_client.h" 14 #include "content/public/browser/content_browser_client.h"
15 #include "content/public/browser/native_web_keyboard_event.h" 15 #include "content/public/browser/native_web_keyboard_event.h"
16 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/render_widget_host_view.h" 19 #include "content/public/browser/render_widget_host_view.h"
20 #include "content/public/browser/site_instance.h" 20 #include "content/public/browser/site_instance.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "extensions/browser/bad_message.h"
22 #include "extensions/browser/event_router.h" 23 #include "extensions/browser/event_router.h"
23 #include "extensions/browser/extension_error.h" 24 #include "extensions/browser/extension_error.h"
24 #include "extensions/browser/extension_host_delegate.h" 25 #include "extensions/browser/extension_host_delegate.h"
25 #include "extensions/browser/extension_host_observer.h" 26 #include "extensions/browser/extension_host_observer.h"
26 #include "extensions/browser/extension_host_queue.h" 27 #include "extensions/browser/extension_host_queue.h"
27 #include "extensions/browser/extension_registry.h" 28 #include "extensions/browser/extension_registry.h"
28 #include "extensions/browser/extension_system.h" 29 #include "extensions/browser/extension_system.h"
29 #include "extensions/browser/extensions_browser_client.h" 30 #include "extensions/browser/extensions_browser_client.h"
30 #include "extensions/browser/load_monitoring_extension_host_queue.h" 31 #include "extensions/browser/load_monitoring_extension_host_queue.h"
31 #include "extensions/browser/notification_types.h" 32 #include "extensions/browser/notification_types.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // This way if a renderer _is_ compromised, it can really only affect itself. 359 // This way if a renderer _is_ compromised, it can really only affect itself.
359 if (unacked_messages_.erase(event_id) > 0) { 360 if (unacked_messages_.erase(event_id) > 0) {
360 FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, 361 FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_,
361 OnBackgroundEventAcked(this, event_id)); 362 OnBackgroundEventAcked(this, event_id));
362 } else { 363 } else {
363 // We have received an unexpected event id from the renderer. It might be 364 // We have received an unexpected event id from the renderer. It might be
364 // compromised or it might have some other issue. Kill it just to be safe. 365 // compromised or it might have some other issue. Kill it just to be safe.
365 DCHECK(render_process_host()); 366 DCHECK(render_process_host());
366 LOG(ERROR) << "Killing renderer for extension " << extension_id() << " for " 367 LOG(ERROR) << "Killing renderer for extension " << extension_id() << " for "
367 << "sending an EventAck message with a bad event id."; 368 << "sending an EventAck message with a bad event id.";
368 render_process_host()->ReceivedBadMessage(); 369 bad_message::ReceivedBadMessage(render_process_host(),
370 bad_message::EH_BAD_EVENT_ID);
369 } 371 }
370 } 372 }
371 373
372 void ExtensionHost::OnIncrementLazyKeepaliveCount() { 374 void ExtensionHost::OnIncrementLazyKeepaliveCount() {
373 ProcessManager::Get(browser_context_) 375 ProcessManager::Get(browser_context_)
374 ->IncrementLazyKeepaliveCount(extension()); 376 ->IncrementLazyKeepaliveCount(extension());
375 } 377 }
376 378
377 void ExtensionHost::OnDecrementLazyKeepaliveCount() { 379 void ExtensionHost::OnDecrementLazyKeepaliveCount() {
378 ProcessManager::Get(browser_context_) 380 ProcessManager::Get(browser_context_)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.BackgroundPageLoadTime2", 471 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.BackgroundPageLoadTime2",
470 load_start_->Elapsed()); 472 load_start_->Elapsed());
471 } 473 }
472 } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { 474 } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) {
473 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", 475 UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2",
474 load_start_->Elapsed()); 476 load_start_->Elapsed());
475 } 477 }
476 } 478 }
477 479
478 } // namespace extensions 480 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/blob_holder.cc ('k') | extensions/browser/guest_view/extension_options/extension_options_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698