diff --git a/core/core.services.yml b/core/core.services.yml
index 2f04124..1fc2751 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -128,7 +128,7 @@ services:
     class: Drupal\Core\Config\InstallStorage
   config.typed:
     class: Drupal\Core\Config\TypedConfigManager
-    arguments: ['@config.storage', '@config.storage.schema', '@cache.discovery', '@module_handler']
+    arguments: ['@config.storage', '@config.storage.schema', '@cache.discovery', '@module_handler', '@event_dispatcher']
     tags:
       - { name: plugin_manager_cache_clear }
   context.handler:
@@ -248,7 +248,7 @@ services:
       - [setContainer, ['@service_container']]
   default_plugin_manager:
     abstract: true
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   module_handler:
     class: Drupal\Core\Extension\ModuleHandler
     arguments: ['%container.modules%', '@cache.bootstrap']
@@ -257,7 +257,7 @@ services:
     arguments: ['@config.factory', '@module_handler', '@state', '@info_parser', '@asset.css.collection_optimizer', '@config.installer', '@router.builder']
   entity.manager:
     class: Drupal\Core\Entity\EntityManager
-    arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager']
+    arguments: ['@container.namespaces', '@module_handler', '@event_dispatcher', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager']
     parent: container.trait
     tags:
       - { name: plugin_manager_cache_clear }
@@ -266,22 +266,22 @@ services:
     arguments: ['@entity.manager', '@form_builder']
   plugin.manager.field.field_type:
     class: Drupal\Core\Field\FieldTypePluginManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.field.widget:
     class: Drupal\Core\Field\WidgetPluginManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@plugin.manager.field.field_type']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', '@plugin.manager.field.field_type']
   plugin.manager.field.formatter:
     class: Drupal\Core\Field\FormatterPluginManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@plugin.manager.field.field_type']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', '@plugin.manager.field.field_type']
   plugin.manager.archiver:
     class: Drupal\Core\Archiver\ArchiverManager
     parent: default_plugin_manager
   plugin.manager.action:
     class: Drupal\Core\Action\ActionManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.menu.link:
     class: Drupal\Core\Menu\MenuLinkManager
-    arguments: ['@menu.tree_storage', '@menu_link.static.overrides', '@module_handler']
+    arguments: ['@menu.tree_storage', '@menu_link.static.overrides', '@module_handler', '@event_dispatcher']
   menu.link_tree:
     class: Drupal\Core\Menu\MenuLinkTree
     arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@router.route_provider', '@menu.active_trail', '@controller_resolver', '@cache.menu', '@current_route_match']
@@ -296,13 +296,13 @@ services:
     arguments: ['@menu.link_tree', '@entity.manager', '@string_translation']
   plugin.manager.menu.local_action:
     class: Drupal\Core\Menu\LocalActionManager
-    arguments: ['@controller_resolver', '@request_stack', '@router.route_provider', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
+    arguments: ['@controller_resolver', '@request_stack', '@router.route_provider', '@module_handler', '@event_dispatcher', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
   plugin.manager.menu.local_task:
     class: Drupal\Core\Menu\LocalTaskManager
-    arguments: ['@controller_resolver', '@request_stack', '@router.route_provider', '@router.builder', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
+    arguments: ['@controller_resolver', '@request_stack', '@router.route_provider', '@router.builder', '@module_handler', '@event_dispatcher', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
   plugin.manager.menu.contextual_link:
     class: Drupal\Core\Menu\ContextualLinkManager
-    arguments: ['@controller_resolver', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user', '@request_stack']
+    arguments: ['@controller_resolver', '@module_handler', '@event_dispatcher', '@cache.discovery', '@language_manager', '@access_manager', '@current_user', '@request_stack']
   plugin.manager.display_variant:
     class: Drupal\Core\Display\VariantManager
     parent: default_plugin_manager
@@ -330,7 +330,7 @@ services:
      class: Drupal\Core\Routing\CurrentRouteMatch
      arguments: ['@request_stack']
   event_dispatcher:
-    class: Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher
+    class: Drupal\Core\EventDispatcher\ContainerAwareEventDispatcher
     arguments: ['@service_container']
   controller_resolver:
     class: Drupal\Core\Controller\ControllerResolver
@@ -745,7 +745,7 @@ services:
       - { name: backend_overridable }
   plugin.manager.mail:
     class: Drupal\Core\Mail\MailManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@config.factory', '@logger.factory', '@string_translation']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', '@config.factory', '@logger.factory', '@string_translation']
   plugin.manager.condition:
     class: Drupal\Core\Condition\ConditionManager
     parent: default_plugin_manager
@@ -764,7 +764,7 @@ services:
       - { name: event_subscriber }
   image.toolkit.manager:
     class: Drupal\Core\ImageToolkit\ImageToolkitManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@config.factory', '@module_handler', '@image.toolkit.operation.manager', '@logger.channel.image']
+    arguments: ['@container.namespaces', '@cache.discovery', '@config.factory', '@module_handler', '@event_dispatcher', '@image.toolkit.operation.manager', '@logger.channel.image']
   image.toolkit.operation.manager:
     class: Drupal\Core\ImageToolkit\ImageToolkitOperationManager
     arguments: ['@logger.channel.image']
diff --git a/core/lib/Drupal/Core/Action/ActionManager.php b/core/lib/Drupal/Core/Action/ActionManager.php
index d3a4c0a..6a8331d 100644
--- a/core/lib/Drupal/Core/Action/ActionManager.php
+++ b/core/lib/Drupal/Core/Action/ActionManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides an Action plugin manager.
@@ -31,9 +32,11 @@ class ActionManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Action', $namespaces, $module_handler, 'Drupal\Core\Annotation\Action');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Action', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Annotation\Action');
     $this->alterInfo('action_info');
     $this->setCacheBackend($cache_backend, 'action_info');
   }
diff --git a/core/lib/Drupal/Core/Archiver/ArchiverManager.php b/core/lib/Drupal/Core/Archiver/ArchiverManager.php
index b161bd9..6d67e83 100644
--- a/core/lib/Drupal/Core/Archiver/ArchiverManager.php
+++ b/core/lib/Drupal/Core/Archiver/ArchiverManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides an Archiver plugin manager.
@@ -30,9 +31,11 @@ class ArchiverManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Archiver', $namespaces, $module_handler, 'Drupal\Core\Archiver\Annotation\Archiver');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Archiver', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Archiver\Annotation\Archiver');
     $this->alterInfo('archiver_info');
     $this->setCacheBackend($cache_backend, 'archiver_info_plugins');
   }
diff --git a/core/lib/Drupal/Core/Condition/ConditionManager.php b/core/lib/Drupal/Core/Condition/ConditionManager.php
index db0fa43..8fa6693 100644
--- a/core/lib/Drupal/Core/Condition/ConditionManager.php
+++ b/core/lib/Drupal/Core/Condition/ConditionManager.php
@@ -13,6 +13,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * A plugin manager for condition plugins.
@@ -37,12 +38,14 @@ class ConditionManager extends DefaultPluginManager implements ExecutableManager
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $this->alterInfo('condition_info');
     $this->setCacheBackend($cache_backend, 'condition_plugins');
 
-    parent::__construct('Plugin/Condition', $namespaces, $module_handler, 'Drupal\Core\Condition\Annotation\Condition');
+    parent::__construct('Plugin/Condition', $namespaces, $module_handler, $event_dispatcher,'Drupal\Core\Condition\Annotation\Condition');
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php
index d775cc2..848d92b 100644
--- a/core/lib/Drupal/Core/Config/TypedConfigManager.php
+++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Config\Schema\ConfigSchemaDiscovery;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\TypedData\TypedDataManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages config type plugins.
@@ -49,13 +50,14 @@ class TypedConfigManager extends TypedDataManager implements TypedConfigManagerI
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache
    *   The cache backend to use for caching the definitions.
    */
-  public function __construct(StorageInterface $configStorage, StorageInterface $schemaStorage, CacheBackendInterface $cache, ModuleHandlerInterface $module_handler) {
+  public function __construct(StorageInterface $configStorage, StorageInterface $schemaStorage, CacheBackendInterface $cache, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $this->configStorage = $configStorage;
     $this->schemaStorage = $schemaStorage;
     $this->setCacheBackend($cache, 'typed_config_definitions');
     $this->discovery = new ConfigSchemaDiscovery($schemaStorage);
     $this->alterInfo('config_schema_info');
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Display/VariantManager.php b/core/lib/Drupal/Core/Display/VariantManager.php
index 7f18a29..9dc7d53 100755
--- a/core/lib/Drupal/Core/Display/VariantManager.php
+++ b/core/lib/Drupal/Core/Display/VariantManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages discovery of display variant plugins.
@@ -29,9 +30,11 @@ class VariantManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/DisplayVariant', $namespaces, $module_handler, 'Drupal\Core\Display\Annotation\DisplayVariant');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/DisplayVariant', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Display\Annotation\DisplayVariant');
 
     $this->setCacheBackend($cache_backend, 'variant_plugins');
     $this->alterInfo('display_variant_plugin');
diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php
index 8cfb35c..195818c 100644
--- a/core/lib/Drupal/Core/Entity/EntityManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityManager.php
@@ -26,6 +26,7 @@
 use Drupal\Core\TypedData\TypedDataManager;
 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages entity type plugin definitions.
@@ -161,6 +162,8 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa
    *   keyed by the corresponding namespace to look for plugin implementations,
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache
    *   The cache backend to use.
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
@@ -170,8 +173,8 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa
    * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
    *   The class resolver.
    */
-  public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, TranslationInterface $translation_manager, ClassResolverInterface $class_resolver, TypedDataManager $typed_data_manager) {
-    parent::__construct('Entity', $namespaces, $module_handler, 'Drupal\Core\Entity\Annotation\EntityType');
+  public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, TranslationInterface $translation_manager, ClassResolverInterface $class_resolver, TypedDataManager $typed_data_manager) {
+    parent::__construct('Entity', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Entity\Annotation\EntityType');
 
     $this->setCacheBackend($cache, 'entity_type', array('entity_types' => TRUE));
     $this->alterInfo('entity_type');
diff --git a/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php b/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php
new file mode 100644
index 0000000..42e7c6d
--- /dev/null
+++ b/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\EventDispatcher\ContainerAwareEventDispatcher.
+ */
+
+namespace Drupal\Core\EventDispatcher;
+
+use Drupal\Core\DependencyInjection\DependencySerializationTrait;
+use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher as BaseContainerAwareEventDispatcher;
+
+/**
+ * Extends the base event dispatcher to be serializable.
+ */
+class ContainerAwareEventDispatcher extends BaseContainerAwareEventDispatcher {
+
+  use DependencySerializationTrait;
+
+}
+
diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php
index 6a5f39a..9947c4f 100644
--- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php
+++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin manager for 'field type' plugins.
@@ -29,9 +30,11 @@ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePl
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Field/FieldType', $namespaces, $module_handler, 'Drupal\Core\Field\Annotation\FieldType');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Field/FieldType', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Field\Annotation\FieldType');
     $this->alterInfo('field_info');
     $this->setCacheBackend($cache_backend, 'field_types_plugins');
   }
diff --git a/core/lib/Drupal/Core/Field/FormatterPluginManager.php b/core/lib/Drupal/Core/Field/FormatterPluginManager.php
index e8bba9c..30e650b 100644
--- a/core/lib/Drupal/Core/Field/FormatterPluginManager.php
+++ b/core/lib/Drupal/Core/Field/FormatterPluginManager.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin type manager for field formatters.
@@ -46,9 +47,9 @@ class FormatterPluginManager extends DefaultPluginManager {
    * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
    *   The 'field type' plugin manager.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager) {
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, FieldTypePluginManagerInterface $field_type_manager) {
 
-    parent::__construct('Plugin/Field/FieldFormatter', $namespaces, $module_handler, 'Drupal\Core\Field\Annotation\FieldFormatter');
+    parent::__construct('Plugin/Field/FieldFormatter', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Field\Annotation\FieldFormatter');
 
     $this->setCacheBackend($cache_backend, 'field_formatter_types_plugins');
     $this->alterInfo('field_formatter_info');
diff --git a/core/lib/Drupal/Core/Field/WidgetPluginManager.php b/core/lib/Drupal/Core/Field/WidgetPluginManager.php
index 2a0145f..bec6b7a 100644
--- a/core/lib/Drupal/Core/Field/WidgetPluginManager.php
+++ b/core/lib/Drupal/Core/Field/WidgetPluginManager.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin type manager for field widgets.
@@ -43,11 +44,13 @@ class WidgetPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
    *   The 'field type' plugin manager.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager) {
-    parent::__construct('Plugin/Field/FieldWidget', $namespaces, $module_handler, 'Drupal\Core\Field\Annotation\FieldWidget');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, FieldTypePluginManagerInterface $field_type_manager) {
+    parent::__construct('Plugin/Field/FieldWidget', $namespaces, $module_handler, $event_dispatcher,'Drupal\Core\Field\Annotation\FieldWidget');
 
     $this->setCacheBackend($cache_backend, 'field_widget_types_plugins');
     $this->alterInfo('field_widget_info');
diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php
index 270f870..4ef16d2 100644
--- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php
+++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php
@@ -13,6 +13,7 @@
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Component\Plugin\Factory\DefaultFactory;
 use Psr\Log\LoggerInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages toolkit plugins.
@@ -52,13 +53,15 @@ class ImageToolkitManager extends DefaultPluginManager {
    *   The config factory.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface $operation_manager
    *   The toolkit operation manager.
    * @param \Psr\Log\LoggerInterface $logger
    *   A logger instance.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger) {
-    parent::__construct('Plugin/ImageToolkit', $namespaces, $module_handler, 'Drupal\Core\ImageToolkit\Annotation\ImageToolkit');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger) {
+    parent::__construct('Plugin/ImageToolkit', $namespaces, $module_handler, $event_dispatcher,'Drupal\Core\ImageToolkit\Annotation\ImageToolkit');
 
     $this->setCacheBackend($cache_backend, 'image_toolkit_plugins');
     $this->configFactory = $config_factory;
diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
index 20ecc55..6632ae5 100644
--- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
+++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
@@ -14,6 +14,7 @@
 use Drupal\Component\Plugin\Factory\DefaultFactory;
 use Drupal\Component\Utility\String;
 use Psr\Log\LoggerInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages toolkit operation plugins.
@@ -37,11 +38,13 @@ class ImageToolkitOperationManager extends DefaultPluginManager implements Image
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Psr\Log\LoggerInterface $logger
    *   A logger instance.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LoggerInterface $logger) {
-    parent::__construct('Plugin/ImageToolkit/Operation', $namespaces, $module_handler, 'Drupal\Core\ImageToolkit\Annotation\ImageToolkitOperation');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, LoggerInterface $logger) {
+    parent::__construct('Plugin/ImageToolkit/Operation', $namespaces, $module_handler, $event_dispatcher,'Drupal\Core\ImageToolkit\Annotation\ImageToolkitOperation');
 
     $this->alterInfo('image_toolkit_operation');
     $this->setCacheBackend($cache_backend, 'image_toolkit_operation_plugins');
diff --git a/core/lib/Drupal/Core/Mail/MailManager.php b/core/lib/Drupal/Core/Mail/MailManager.php
index 48e53cf..415a7cf 100644
--- a/core/lib/Drupal/Core/Mail/MailManager.php
+++ b/core/lib/Drupal/Core/Mail/MailManager.php
@@ -16,6 +16,7 @@
 use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslationInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides a Mail plugin manager.
@@ -59,6 +60,8 @@ class MailManager extends DefaultPluginManager implements MailManagerInterface {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The configuration factory.
    * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
@@ -66,8 +69,8 @@ class MailManager extends DefaultPluginManager implements MailManagerInterface {
    * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
    *   The string translation service.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, TranslationInterface $string_translation) {
-    parent::__construct('Plugin/Mail', $namespaces, $module_handler, 'Drupal\Core\Annotation\Mail');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, TranslationInterface $string_translation) {
+    parent::__construct('Plugin/Mail', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Annotation\Mail');
     $this->alterInfo('mail_backend_info');
     $this->setCacheBackend($cache_backend, 'mail_backend_plugins');
     $this->configFactory = $config_factory;
diff --git a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php
index cbbf4e4..8630093 100644
--- a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php
+++ b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php
@@ -18,6 +18,7 @@
 use Drupal\Core\Plugin\Discovery\YamlDiscovery;
 use Drupal\Core\Plugin\Factory\ContainerFactory;
 use Drupal\Core\Session\AccountInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
@@ -91,6 +92,8 @@ class ContextualLinkManager extends DefaultPluginManager implements ContextualLi
    *   The controller resolver.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
    *   The cache backend.
    * @param \Drupal\Core\Language\LanguageManager $language_manager
@@ -102,7 +105,7 @@ class ContextualLinkManager extends DefaultPluginManager implements ContextualLi
    * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
    *   The request stack.
    */
-  public function __construct(ControllerResolverInterface $controller_resolver, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManager $language_manager, AccessManagerInterface $access_manager, AccountInterface $account, RequestStack $request_stack) {
+  public function __construct(ControllerResolverInterface $controller_resolver, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, CacheBackendInterface $cache_backend, LanguageManager $language_manager, AccessManagerInterface $access_manager, AccountInterface $account, RequestStack $request_stack) {
     $this->discovery = new YamlDiscovery('links.contextual', $module_handler->getModuleDirectories());
     $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
     $this->factory = new ContainerFactory($this);
@@ -111,6 +114,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Mo
     $this->accessManager = $access_manager;
     $this->account = $account;
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
     $this->requestStack = $request_stack;
     $this->alterInfo('contextual_links_plugins');
     $this->setCacheBackend($cache_backend, 'contextual_links_plugins:' . $language_manager->getCurrentLanguage()->getId(), array('contextual_links_plugins' => TRUE));
diff --git a/core/lib/Drupal/Core/Menu/LocalActionManager.php b/core/lib/Drupal/Core/Menu/LocalActionManager.php
index 1167357..ce2ba97 100644
--- a/core/lib/Drupal/Core/Menu/LocalActionManager.php
+++ b/core/lib/Drupal/Core/Menu/LocalActionManager.php
@@ -16,6 +16,7 @@
 use Drupal\Core\Plugin\Discovery\YamlDiscovery;
 use Drupal\Core\Plugin\Factory\ContainerFactory;
 use Drupal\Core\Routing\RouteProviderInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -107,6 +108,8 @@ class LocalActionManager extends DefaultPluginManager {
    *   The route provider.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
    *   Cache backend instance to use.
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
@@ -116,7 +119,7 @@ class LocalActionManager extends DefaultPluginManager {
    * @param \Drupal\Core\Session\AccountInterface $account
    *   The current user.
    */
-  public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
+  public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
     // Skip calling the parent constructor, since that assumes annotation-based
     // discovery.
     $this->discovery = new YamlDiscovery('links.action', $module_handler->getModuleDirectories());
@@ -127,6 +130,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re
     $this->routeProvider = $route_provider;
     $this->accessManager = $access_manager;
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
     $this->account = $account;
     $this->alterInfo('menu_local_actions');
     $this->setCacheBackend($cache_backend, 'local_action_plugins:' . $language_manager->getCurrentLanguage()->getId(), array('local_action' => TRUE));
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
index 839ef32..b9a917b 100644
--- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php
+++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
@@ -21,6 +21,7 @@
 use Drupal\Core\Routing\RouteBuilderInterface;
 use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\Session\AccountInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
@@ -118,6 +119,8 @@ class LocalTaskManager extends DefaultPluginManager {
    *   The route builder.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache
    *   The cache backend.
    * @param \Drupal\Core\Language\LanguageManager $language_manager
@@ -127,7 +130,7 @@ class LocalTaskManager extends DefaultPluginManager {
    * @param \Drupal\Core\Session\AccountInterface $account
    *   The current user.
    */
-  public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
+  public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, CacheBackendInterface $cache, LanguageManager $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
     $this->discovery = new YamlDiscovery('links.task', $module_handler->getModuleDirectories());
     $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
     $this->factory = new ContainerFactory($this);
@@ -138,6 +141,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re
     $this->accessManager = $access_manager;
     $this->account = $account;
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
     $this->alterInfo('local_tasks');
     $this->setCacheBackend($cache, 'local_task_plugins:' . $language_manager->getCurrentLanguage()->getId(), array('local_task' => TRUE));
   }
diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
index e1d0731..60c7a6d 100644
--- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
+++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
@@ -7,9 +7,9 @@
 
 namespace Drupal\Core\Plugin;
 
+use Drupal\Core\Plugin\PluginRemovalEvents;
 use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
 use Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait;
-use Drupal\Component\Plugin\Exception\PluginNotFoundException;
 use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
 use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Component\Plugin\PluginManagerInterface;
@@ -17,16 +17,17 @@
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+use Drupal\Core\Plugin\Event\PluginRemovalEvent;
 use Drupal\Core\Plugin\Factory\ContainerFactory;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Base class for plugin managers.
  *
  * @ingroup plugin_api
  */
-class DefaultPluginManager extends PluginManagerBase implements PluginManagerInterface, CachedDiscoveryInterface {
+class DefaultPluginManager extends PluginManagerBase implements PluginManagerInterface, CachedDiscoveryInterface, DefaultPluginManagerInterface {
 
   use DiscoveryCachedTrait;
 
@@ -74,6 +75,13 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
   protected $moduleHandler;
 
   /**
+   * The event dispatcher.
+   *
+   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
+   */
+  protected $eventDispatcher;
+
+  /**
    * A set of defaults to be referenced by $this->processDefinition() if
    * additional processing of plugins is necessary or helpful for development
    * purposes.
@@ -92,37 +100,23 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt
    *   keyed by the corresponding namespace to look for plugin implementations.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param string $plugin_definition_annotation_name
    *   (optional) The name of the annotation that contains the plugin definition.
    *   Defaults to 'Drupal\Component\Annotation\Plugin'.
    */
-  public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
+  public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
     $this->subdir = $subdir;
     $this->discovery = new AnnotatedClassDiscovery($subdir, $namespaces, $plugin_definition_annotation_name);
     $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
     $this->factory = new ContainerFactory($this);
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
   }
 
   /**
-   * Initialize the cache backend.
-   *
-   * Plugin definitions are cached using the provided cache backend. The
-   * interface language is added as a suffix to the cache key.
-   *
-   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
-   *   Cache backend instance to use.
-   * @param string $cache_key
-   *   Cache key prefix to use, the language code will be appended
-   *   automatically.
-   * @param array $cache_tags
-   *   (optional) When providing a list of cache tags, the cached plugin
-   *   definitions are tagged with the provided cache tags. These cache tags can
-   *   then be used to clear the corresponding cached plugin definitions. Note
-   *   that this should be used with care! For clearing all cached plugin
-   *   definitions of a plugin manager, call that plugin manager's
-   *   clearCachedDefinitions() method. Only use cache tags when cached plugin
-   *   definitions should be cleared along with other, related cache entries.
+   * {@inheritdoc}
    */
   public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key, array $cache_tags = array()) {
     $this->cacheBackend = $cache_backend;
@@ -241,4 +235,16 @@ protected function findDefinitions() {
     return $definitions;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function removePluginId($plugin_id, $permanent = TRUE, array $conditions = array()) {
+    /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */
+    $event_dispatcher = \Drupal::service('event_dispatcher');
+    $event_name = $permanent ? PluginRemovalEvents::PERMANENTLY_UNAVAILABLE : PluginRemovalEvents::TEMPORARILY_UNAVAILABLE;
+    // @todo Introduce a proper plugin type.
+    $plugin_type = isset($this->subdir) ? strtolower(str_replace('/', '_', $this->subdir)) : get_class($this);
+    $event_dispatcher->dispatch($event_name, new PluginRemovalEvent($plugin_type, $plugin_id, $permanent, $conditions));
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManagerInterface.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManagerInterface.php
new file mode 100644
index 0000000..05e6853
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManagerInterface.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\DefaultPluginManagerInterface.
+ */
+
+namespace Drupal\Core\Plugin;
+
+use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\Core\Cache\CacheBackendInterface;
+
+/**
+ * Extends the plugin manager interface with drupal specific methods.
+ */
+interface DefaultPluginManagerInterface extends PluginManagerInterface {
+
+  /**
+   * Initialize the cache backend.
+   *
+   * Plugin definitions are cached using the provided cache backend. The
+   * interface language is added as a suffix to the cache key.
+   *
+   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
+   *   Cache backend instance to use.
+   * @param string $cache_key
+   *   Cache key prefix to use, the language code will be appended
+   *   automatically.
+   * @param array $cache_tags
+   *   (optional) When providing a list of cache tags, the cached plugin
+   *   definitions are tagged with the provided cache tags. These cache tags can
+   *   then be used to clear the corresponding cached plugin definitions. Note
+   *   that this should be used with care! For clearing all cached plugin
+   *   definitions of a plugin manager, call that plugin manager's
+   *   clearCachedDefinitions() method. Only use cache tags when cached plugin
+   *   definitions should be cleared along with other, related cache entries.
+   */
+  public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key, array $cache_tags = array());
+
+  /**
+   * Announces that the plugin with the specified ID disappears.
+   *
+   * The plugin might be removed permanently, for example when something on
+   * which it depends is deleted, or it might be removed temporarily, for
+   * example when something is disabled but might be re-enabled in the future.
+   *
+   * A concrete example is that you want to remove each block configuration
+   * once a content block is removed.
+   *
+   * @param string $plugin_id
+   *   The ID of the plugin that is removed.
+   * @param bool $permanent
+   *   (optional) Indicates whether the plugin is removed permanently or just
+   *   temporarily disabled.
+   * @param array $conditions
+   *   (optional) An array of information that is passed on to the subscribers
+   *   to help them decide how to react on the plugin removal.
+   */
+  public function removePluginId($plugin_id, $permanent = TRUE, array $conditions = array());
+
+}
diff --git a/core/lib/Drupal/Core/Plugin/Event/PluginRemovalEvent.php b/core/lib/Drupal/Core/Plugin/Event/PluginRemovalEvent.php
new file mode 100644
index 0000000..625a894
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/Event/PluginRemovalEvent.php
@@ -0,0 +1,106 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\Event\PluginRemovalEvent.
+ */
+
+namespace Drupal\Core\Plugin\Event;
+
+use Symfony\Component\EventDispatcher\Event;
+
+/**
+ * Event that fires when a plugin is removed.
+ */
+class PluginRemovalEvent extends Event {
+
+  /**
+   * The plugin type.
+   *
+   * @var string
+   */
+  protected $pluginType;
+
+  /**
+   * The plugin ID.
+   *
+   * @var string
+   */
+  protected $pluginId;
+
+  /**
+   * Whether or not the removal of the plugin is permanent.
+   *
+   * @var bool
+   */
+  protected $permanent;
+
+  /**
+   * An array of conditions.
+   *
+   * These are provided to help subscribers deciding how to act on the removal.
+   *
+   * @var array
+   */
+  protected $conditions;
+
+  /**
+   * Constructs a PluginRemoveEvent object.
+   *
+   * @param string $plugin_type
+   *   A unique string for each plugin type.
+   * @param string $plugin_id
+   *   The ID of the plugin that is being removed.
+   * @param bool $permanent
+   *   Whether or not the removal of the plugin is permanent. Defaults to TRUE.
+   * @param array $conditions
+   *   An array of conditions intended to help subscribers to decide how to act
+   *   on the plugin removal.
+   */
+  public function __construct($plugin_type, $plugin_id, $permanent = TRUE, array $conditions = array()) {
+    $this->pluginType = $plugin_type;
+    $this->pluginId = $plugin_id;
+    $this->permanent = $permanent;
+    $this->conditions = $conditions;
+  }
+
+  /**
+   * Returns the plugin removal conditions.
+   *
+   * @return array
+   *   An array of conditions.
+   */
+  public function getConditions() {
+    return $this->conditions;
+  }
+
+  /**
+   * Returns whether or not the plugin removal is permanent.
+   *
+   * @return bool
+   *   TRUE if the removal is permanent, FALSE otherwise.
+   */
+  public function getPersistence() {
+    return $this->permanent;
+  }
+
+  /**
+   * Returns the ID of the plugin that is being removed.
+   *
+   * @return string
+   *   The plugin ID.
+   */
+  public function getPluginId() {
+    return $this->pluginId;
+  }
+
+  /**
+   * Returns the plugin type of the plugin that is being removed.
+   *
+   * @return string
+   */
+  public function getPluginType() {
+    return $this->pluginType;
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Plugin/PluginRemovalEvents.php b/core/lib/Drupal/Core/Plugin/PluginRemovalEvents.php
new file mode 100644
index 0000000..c01f9b5
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/PluginRemovalEvents.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\PluginRemovalEvents.
+ */
+
+namespace Drupal\Core\Plugin;
+
+/**
+ * Contains events fired when a plugin instance becomes unavailable.
+ */
+class PluginRemovalEvents {
+
+  /**
+   * This event is thrown when a plugin is temporary unavailable.
+   *
+   * This could be the case, when something is disabled but not deleted.
+   */
+  const TEMPORARILY_UNAVAILABLE = 'plugin.unavailable.temporarily';
+
+  /**
+   * This event is thrown when a plugin is permanently unavailable.
+   *
+   * This could be the case, when a module has been uninstalled or the data
+   * from which a plugin was derived was deleted.
+   */
+  const PERMANENTLY_UNAVAILABLE = 'plugin.unavailable.permanently';
+
+}
diff --git a/core/lib/Drupal/Core/Render/ElementInfoManager.php b/core/lib/Drupal/Core/Render/ElementInfoManager.php
index 1dd2be4..a7c83d0 100644
--- a/core/lib/Drupal/Core/Render/ElementInfoManager.php
+++ b/core/lib/Drupal/Core/Render/ElementInfoManager.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\Render\Element\FormElementInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides a plugin manager for element plugins.
@@ -42,11 +43,13 @@ class ElementInfoManager extends DefaultPluginManager implements ElementInfoMana
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $this->setCacheBackend($cache_backend, 'element_info');
 
-    parent::__construct('Element', $namespaces, $module_handler, 'Drupal\Core\Render\Annotation\RenderElement');
+    parent::__construct('Element', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\Render\Annotation\RenderElement');
   }
 
   /**
diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php
index c9afe86..8872972 100644
--- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php
+++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php
@@ -15,6 +15,7 @@
 use Drupal\Core\TypedData\Validation\MetadataFactory;
 use Drupal\Core\Validation\ConstraintManager;
 use Drupal\Core\Validation\DrupalTranslator;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\Validator\ValidatorInterface;
 use Symfony\Component\Validator\Validation;
 
@@ -54,12 +55,14 @@ class TypedDataManager extends DefaultPluginManager {
   *   Cache backend instance to use.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
+  * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+  *   The event dispatcher.
   */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $this->alterInfo('data_type_info');
     $this->setCacheBackend($cache_backend, 'typed_data_types_plugins');
 
-    parent::__construct('Plugin/DataType', $namespaces, $module_handler, 'Drupal\Core\TypedData\Annotation\DataType');
+    parent::__construct('Plugin/DataType', $namespaces, $module_handler, $event_dispatcher, 'Drupal\Core\TypedData\Annotation\DataType');
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Validation/ConstraintManager.php b/core/lib/Drupal/Core/Validation/ConstraintManager.php
index a2b46d3..a543230 100644
--- a/core/lib/Drupal/Core/Validation/ConstraintManager.php
+++ b/core/lib/Drupal/Core/Validation/ConstraintManager.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\StringTranslation\TranslationWrapper;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Constraint plugin manager.
@@ -43,9 +44,11 @@ class ConstraintManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Validation/Constraint', $namespaces, $module_handler);
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Validation/Constraint', $namespaces, $module_handler, $event_dispatcher);
     $this->discovery = new StaticDiscoveryDecorator($this->discovery, array($this, 'registerDefinitions'));
     $this->alterInfo('validation_constraint');
     $this->setCacheBackend($cache_backend, 'validation_constraint_plugins');
diff --git a/core/modules/aggregator/aggregator.services.yml b/core/modules/aggregator/aggregator.services.yml
index 930b945..f77d305 100644
--- a/core/modules/aggregator/aggregator.services.yml
+++ b/core/modules/aggregator/aggregator.services.yml
@@ -1,13 +1,13 @@
 services:
   plugin.manager.aggregator.fetcher:
     class: Drupal\aggregator\Plugin\AggregatorPluginManager
-    arguments: [fetcher, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [fetcher, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.aggregator.parser:
     class: Drupal\aggregator\Plugin\AggregatorPluginManager
-    arguments: [parser, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [parser, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.aggregator.processor:
     class: Drupal\aggregator\Plugin\AggregatorPluginManager
-    arguments: [processor, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [processor, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   aggregator.items.importer:
     class: Drupal\aggregator\ItemsImporter
     arguments: ['@config.factory', '@plugin.manager.aggregator.fetcher', '@plugin.manager.aggregator.parser', '@plugin.manager.aggregator.processor']
diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php
index 6362d2d..7c1815a 100644
--- a/core/modules/aggregator/src/Entity/Feed.php
+++ b/core/modules/aggregator/src/Entity/Feed.php
@@ -110,15 +110,12 @@ public static function preDelete(EntityStorageInterface $storage, array $entitie
    */
   public static function postDelete(EntityStorageInterface $storage, array $entities) {
     parent::postDelete($storage, $entities);
-    if (\Drupal::moduleHandler()->moduleExists('block')) {
-      // Make sure there are no active blocks for these feeds.
-      $ids = \Drupal::entityQuery('block')
-        ->condition('plugin', 'aggregator_feed_block')
-        ->condition('settings.feed', array_keys($entities))
-        ->execute();
-      if ($ids) {
-        $block_storage = \Drupal::entityManager()->getStorage('block');
-        $block_storage->delete($block_storage->loadMultiple($ids));
+
+    // Make sure there are no active blocks for these feeds.
+    /** @var \Drupal\Core\Plugin\DefaultPluginManagerInterface $block_manager */
+    if (\Drupal::hasService('plugin.manager.block') && $block_manager = \Drupal::service('plugin.manager.block')) {
+      foreach ($entities as $entity) {
+        $block_manager->removePluginId('aggregator_feed_block', FALSE, array('settings.feed' => $entity->id()));
       }
     }
   }
diff --git a/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php b/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php
index 53c3acd..486589c 100644
--- a/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php
+++ b/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages aggregator plugins.
@@ -37,15 +38,17 @@ class AggregatorPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $type_annotations = array(
       'fetcher' => 'Drupal\aggregator\Annotation\AggregatorFetcher',
       'parser' => 'Drupal\aggregator\Annotation\AggregatorParser',
       'processor' => 'Drupal\aggregator\Annotation\AggregatorProcessor',
     );
 
-    parent::__construct("Plugin/aggregator/$type", $namespaces, $module_handler, $type_annotations[$type]);
+    parent::__construct("Plugin/aggregator/$type", $namespaces, $module_handler, $event_dispatcher, $type_annotations[$type]);
     $this->setCacheBackend($cache_backend, 'aggregator_' . $type . '_plugins');
   }
 
diff --git a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
index d967d1b..e89ddc0 100644
--- a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
+++ b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
@@ -77,6 +77,17 @@ public function testBlockLinks() {
     // Check that the block is no longer displayed.
     $this->drupalGet('test-page');
     $this->assertNoText($block->label(), 'Feed block is not displayed on the page when number of items is set to 0.');
+
+    // Set the number of news items to 5 to test that the block shows again.
+    $block->getPlugin()->setConfigurationValue('block_count', 5);
+    $block->save();
+    $this->drupalGet('test-page');
+    $this->assertText($block->label(), 'Feed block is displayed again on the page when number of items is set to 5.');
+
+    // Delete the feed and check that the block is no longer displayed.
+    $feed->delete();
+    $this->drupalGet('test-page');
+    $this->assertNoText($block->label(), 'Feed block is not displayed on the page once deleted.');
   }
 
   /**
diff --git a/core/modules/block/block.services.yml b/core/modules/block/block.services.yml
index e5e58d1..b268091 100644
--- a/core/modules/block/block.services.yml
+++ b/core/modules/block/block.services.yml
@@ -1,7 +1,9 @@
 services:
   plugin.manager.block:
     class: Drupal\block\BlockManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@string_translation']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', '@string_translation']
+    tags:
+      - { name: event_subscriber }
   theme.negotiator.block.admin_demo:
     class: Drupal\block\Theme\AdminDemoNegotiator
     tags:
@@ -21,3 +23,8 @@ services:
     arguments: ['@current_route_match']
     tags:
       - { name: 'event_subscriber' }
+  block.entity.event.subscriber:
+    class: Drupal\block\BlockEntityBlockEventSubscriber
+    arguments: ['@entity.query', '@entity.manager']
+    tags:
+      - { name: event_subscriber }
diff --git a/core/modules/block/src/BlockEntityBlockEventSubscriber.php b/core/modules/block/src/BlockEntityBlockEventSubscriber.php
new file mode 100644
index 0000000..2589071
--- /dev/null
+++ b/core/modules/block/src/BlockEntityBlockEventSubscriber.php
@@ -0,0 +1,76 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block\BlockEntityBlockEventSubscriber.
+ */
+
+namespace Drupal\block;
+
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Plugin\Event\PluginRemovalEvent;
+use Drupal\Core\Plugin\PluginRemovalEvents;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+
+/**
+ * Contains block entity responses to block plugin events.
+ */
+class BlockEntityBlockEventSubscriber implements EventSubscriberInterface {
+
+  /**
+   * The entity query factory.
+   *
+   * @var \Drupal\Core\Entity\Query\QueryFactory
+   */
+  protected $queryFactory;
+
+  /**
+   * The block storage controller.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageInterface
+   */
+  protected $blockStorageController;
+
+  /**
+   * Constructs a \Drupal\block\BlockEntityBlockEventSubscriber object.
+   *
+   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
+   *   The entity query factory.
+   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   *   The entity manager.
+   */
+  public function __construct(QueryFactory $query_factory, EntityManagerInterface $entity_manager) {
+    $this->queryFactory = $query_factory;
+    $this->blockStorageController = $entity_manager->getStorage('block');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getSubscribedEvents() {
+    $events[PluginRemovalEvents::PERMANENTLY_UNAVAILABLE][] = 'deleteEntityByPlugin';
+    $events[PluginRemovalEvents::TEMPORARILY_UNAVAILABLE][] = 'deleteEntityByPlugin';
+
+    return $events;
+  }
+
+  /**
+   * Reacts on removing a block plugin.
+   */
+  public function deleteEntityByPlugin(PluginRemovalEvent $event) {
+    if ($event->getPluginType() != 'plugin_block') {
+      return;
+    }
+    $query = $this->queryFactory->get('block');
+    $query->condition('plugin', $event->getPluginId());
+    foreach ($event->getConditions() as $condition => $value) {
+      $query->condition($condition, $value);
+    }
+    $result = $query->execute();
+    if ($blocks = $this->blockStorageController->loadMultiple($result)) {
+      $this->blockStorageController->delete($blocks);
+    }
+  }
+
+}
diff --git a/core/modules/block/src/BlockManager.php b/core/modules/block/src/BlockManager.php
index 706af51..bac01a0 100644
--- a/core/modules/block/src/BlockManager.php
+++ b/core/modules/block/src/BlockManager.php
@@ -11,8 +11,12 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\Core\Plugin\Event\PluginRemovalEvent;
+use Drupal\Core\Plugin\PluginRemovalEvents;
 use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
  * Manages discovery and instantiation of block plugins.
@@ -21,7 +25,7 @@
  *
  * @see \Drupal\block\BlockPluginInterface
  */
-class BlockManager extends DefaultPluginManager implements BlockManagerInterface {
+class BlockManager extends DefaultPluginManager implements BlockManagerInterface, EventSubscriberInterface {
 
   use StringTranslationTrait;
   use ContextAwarePluginManagerTrait;
@@ -43,11 +47,13 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
    *   The translation manager.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, TranslationInterface $string_translation) {
-    parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\block\Annotation\Block');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, TranslationInterface $string_translation) {
+    parent::__construct('Plugin/Block', $namespaces, $module_handler, $event_dispatcher, 'Drupal\block\Annotation\Block');
 
     $this->alterInfo('block');
     $this->setCacheBackend($cache_backend, 'block_plugins');
@@ -115,4 +121,22 @@ public function getSortedDefinitions() {
     return $definitions;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function getSubscribedEvents() {
+    $events[PluginRemovalEvents::PERMANENTLY_UNAVAILABLE][] = 'blockPluginRemoved';
+    return $events;
+  }
+
+  /**
+   * Reacts on removing a block plugin.
+   *
+   * @param \Drupal\Core\Plugin\Event\PluginRemovalEvent $event
+   *   The event containing the plugin ID which is updated.
+   */
+  public function blockPluginRemoved(PluginRemovalEvent $event) {
+    $this->clearCachedDefinitions();
+  }
+
 }
diff --git a/core/modules/block/src/BlockManagerInterface.php b/core/modules/block/src/BlockManagerInterface.php
index 6656004..b6598f8 100644
--- a/core/modules/block/src/BlockManagerInterface.php
+++ b/core/modules/block/src/BlockManagerInterface.php
@@ -8,11 +8,12 @@
 namespace Drupal\block;
 
 use Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface;
+use Drupal\Core\Plugin\DefaultPluginManagerInterface;
 
 /**
  * Provides an interface for the discovery and instantiation of block plugins.
  */
-interface BlockManagerInterface extends ContextAwarePluginManagerInterface {
+interface BlockManagerInterface extends ContextAwarePluginManagerInterface, DefaultPluginManagerInterface {
 
   /**
    * Gets the names of all block categories.
diff --git a/core/modules/block/src/Plugin/views/display/Block.php b/core/modules/block/src/Plugin/views/display/Block.php
index 9f48213..f64880b 100644
--- a/core/modules/block/src/Plugin/views/display/Block.php
+++ b/core/modules/block/src/Plugin/views/display/Block.php
@@ -8,11 +8,13 @@
 
 namespace Drupal\block\Plugin\views\display;
 
+use Drupal\block\BlockManagerInterface;
 use Drupal\Component\Utility\String;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Plugin\Block\ViewsBlock;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Views;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * The plugin that handles a block.
@@ -42,6 +44,14 @@ class Block extends DisplayPluginBase {
    */
   protected $usesAttachments = TRUE;
 
+  /**
+   * The block manager.
+   *
+   *
+   * @var \Drupal\block\BlockManagerInterface
+   */
+  protected $blockManager;
+
   protected function defineOptions() {
     $options = parent::defineOptions();
 
@@ -59,6 +69,33 @@ protected function defineOptions() {
   }
 
   /**
+   * Constructs a new Block object.
+   *
+   * @param array $configuration
+   *   A configuration array containing information about the plugin instance.
+   * @param string $plugin_id
+   *   The plugin_id for the plugin instance.
+   * @param mixed $plugin_definition
+   *   The plugin implementation definition.
+   * @param \Drupal\block\BlockManagerInterface $block_manager
+   *   The block plugin manager.
+   */
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, BlockManagerInterface $block_manager) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+
+    $this->blockManager = $block_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    return new static($configuration, $plugin_id, $plugin_definition,
+      $container->get('plugin.manager.block')
+    );
+  }
+
+  /**
    * Returns plugin-specific settings for the block.
    *
    * @param array $settings
@@ -318,15 +355,13 @@ public function usesExposed() {
     }
 
   /**
-   * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::remove().
+   * {@inheritdoc}
    */
   public function remove() {
     parent::remove();
 
     $plugin_id = 'views_block:' . $this->view->storage->id() . '-' . $this->display['id'];
-    foreach (entity_load_multiple_by_properties('block', array('plugin' => $plugin_id)) as $block) {
-      $block->delete();
-    }
+    $this->blockManager->removePluginId($plugin_id, TRUE);
   }
 
 }
diff --git a/core/modules/block/tests/src/BlockManagerTest.php b/core/modules/block/tests/src/BlockManagerTest.php
new file mode 100644
index 0000000..60344c9
--- /dev/null
+++ b/core/modules/block/tests/src/BlockManagerTest.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block\Tests\BlockManagerTest.
+ */
+
+namespace Drupal\block\Tests;
+
+use Drupal\Core\Plugin\Event\PluginRemovalEvent;
+use Drupal\Core\Plugin\PluginRemovalEvents;
+use Drupal\Tests\UnitTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcher;
+
+/**
+ * Tests the block plugin manager.
+ *
+ * @group block
+ *
+ * @coversDefaultClass \Drupal\block\Plugin\BlockManager
+ */
+class BlockManagerTest extends UnitTestCase {
+
+  /**
+   * Tests the reaction when firing block plugin events.
+   *
+   * @covers ::getSubscribedEvents
+   * @covers ::blockPluginRemoved
+   */
+  public function testBlockPluginEvents() {
+    $event_dispatcher = new EventDispatcher();
+
+    $block_manager = $this->getMockBuilder('Drupal\block\BlockManager')
+      ->disableOriginalConstructor()
+      ->setMethods(array('clearCachedDefinitions'))
+      ->getMock();
+
+    $block_manager->expects($this->once())
+      ->method('clearCachedDefinitions');
+
+    $event_dispatcher->addSubscriber($block_manager);
+    $event = new PluginRemovalEvent('plugin_block', 'test_plugin_id');
+
+    $event_dispatcher->dispatch(PluginRemovalEvents::PERMANENTLY_UNAVAILABLE, $event);
+  }
+
+}
diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php
index c06d4e8..0f915b6 100644
--- a/core/modules/block_content/src/Entity/BlockContent.php
+++ b/core/modules/block_content/src/Entity/BlockContent.php
@@ -128,9 +128,11 @@ public function preSaveRevision(EntityStorageInterface $storage, \stdClass $reco
    * {@inheritdoc}
    */
   public function delete() {
-    foreach ($this->getInstances() as $instance) {
-      $instance->delete();
-    }
+    // Allow subscribers to react to the removal of the block.
+    /** @var \Drupal\block\BlockManagerInterface $block_manager */
+    $block_manager = \Drupal::service('plugin.manager.block');
+    $block_manager->removePluginId('block_content:' . $this->uuid());
+
     parent::delete();
   }
 
diff --git a/core/modules/ckeditor/src/CKEditorPluginManager.php b/core/modules/ckeditor/src/CKEditorPluginManager.php
index 289c906..5dbc2d0 100644
--- a/core/modules/ckeditor/src/CKEditorPluginManager.php
+++ b/core/modules/ckeditor/src/CKEditorPluginManager.php
@@ -13,6 +13,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\editor\Entity\Editor;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides a CKEditor Plugin plugin manager.
@@ -37,9 +38,11 @@ class CKEditorPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/CKEditorPlugin', $namespaces, $module_handler, 'Drupal\ckeditor\Annotation\CKEditorPlugin');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/CKEditorPlugin', $namespaces, $module_handler, $event_dispatcher,'Drupal\ckeditor\Annotation\CKEditorPlugin');
     $this->alterInfo('ckeditor_plugin_info');
     $this->setCacheBackend($cache_backend, 'ckeditor_plugins');
   }
diff --git a/core/modules/config_translation/config_translation.services.yml b/core/modules/config_translation/config_translation.services.yml
index f4ed510..322a456 100644
--- a/core/modules/config_translation/config_translation.services.yml
+++ b/core/modules/config_translation/config_translation.services.yml
@@ -23,5 +23,6 @@ services:
       - '@cache.default'
       - '@language_manager'
       - '@module_handler'
+      - '@event_dispatcher'
       - '@config.typed'
       - '@theme_handler'
diff --git a/core/modules/config_translation/src/ConfigMapperManager.php b/core/modules/config_translation/src/ConfigMapperManager.php
index 8eb3735..e2456d5 100644
--- a/core/modules/config_translation/src/ConfigMapperManager.php
+++ b/core/modules/config_translation/src/ConfigMapperManager.php
@@ -21,6 +21,7 @@
 use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
 use Drupal\Core\Plugin\Factory\ContainerFactory;
 use Drupal\Core\TypedData\TypedDataInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\Routing\RouteCollection;
 
 /**
@@ -61,10 +62,12 @@ class ConfigMapperManager extends DefaultPluginManager implements ConfigMapperMa
    *   The language manager.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
    *   The typed config manager.
    */
-  public function __construct(CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, TypedConfigManagerInterface $typed_config_manager, ThemeHandlerInterface $theme_handler) {
+  public function __construct(CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, TypedConfigManagerInterface $typed_config_manager, ThemeHandlerInterface $theme_handler) {
     $this->typedConfigManager = $typed_config_manager;
 
     // Look at all themes and modules.
@@ -94,6 +97,7 @@ public function __construct(CacheBackendInterface $cache_backend, LanguageManage
 
     // Let others alter definitions with hook_config_translation_info_alter().
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
     $this->themeHandler = $theme_handler;
 
     $this->alterInfo('config_translation_info');
diff --git a/core/modules/config_translation/tests/src/ConfigMapperManagerTest.php b/core/modules/config_translation/tests/src/ConfigMapperManagerTest.php
index d7c47cb..57e9b70 100644
--- a/core/modules/config_translation/tests/src/ConfigMapperManagerTest.php
+++ b/core/modules/config_translation/tests/src/ConfigMapperManagerTest.php
@@ -56,11 +56,13 @@ public function setUp() {
     $theme_handler->expects($this->any())
       ->method('listInfo')
       ->will($this->returnValue(array()));
+    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
 
     $this->configMapperManager = new ConfigMapperManager(
       $this->getMock('Drupal\Core\Cache\CacheBackendInterface'),
       $language_manager,
       $module_handler,
+      $event_dispatcher,
       $this->typedConfigManager,
       $theme_handler
     );
diff --git a/core/modules/editor/src/Plugin/EditorManager.php b/core/modules/editor/src/Plugin/EditorManager.php
index 8c9dd92..aee34fc 100644
--- a/core/modules/editor/src/Plugin/EditorManager.php
+++ b/core/modules/editor/src/Plugin/EditorManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Configurable text editor manager.
@@ -26,9 +27,11 @@ class EditorManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Editor', $namespaces, $module_handler, 'Drupal\editor\Annotation\Editor');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Editor', $namespaces, $module_handler, $event_dispatcher, 'Drupal\editor\Annotation\Editor');
     $this->alterInfo('editor_info');
     $this->setCacheBackend($cache_backend, 'editor_plugins');
   }
diff --git a/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php b/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php
index ce5ff83..f4910fb 100644
--- a/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php
+++ b/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php
@@ -16,6 +16,7 @@
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
 use Drupal\entity_reference\Plugin\Type\Selection\SelectionBroken;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin type manager for Entity Reference Selection plugins.
@@ -31,7 +32,7 @@ class SelectionPluginManager extends DefaultPluginManager {
   /**
    * {@inheritdoc}
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $this->discovery = new AnnotatedClassDiscovery('Plugin/entity_reference/selection', $namespaces, 'Drupal\entity_reference\Annotation\EntityReferenceSelection');
 
     // We're not using the parent constructor because we use a different factory
@@ -39,6 +40,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
     $this->factory = new ReflectionFactory($this);
 
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
     $this->alterInfo('entity_reference_selection');
     $this->setCacheBackend($cache_backend, 'entity_reference_selection_plugins');
   }
diff --git a/core/modules/filter/src/FilterPluginManager.php b/core/modules/filter/src/FilterPluginManager.php
index 77a3c71..263acbb 100644
--- a/core/modules/filter/src/FilterPluginManager.php
+++ b/core/modules/filter/src/FilterPluginManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages text processing filters.
@@ -32,9 +33,11 @@ class FilterPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Filter', $namespaces, $module_handler, 'Drupal\filter\Annotation\Filter');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Filter', $namespaces, $module_handler, $event_dispatcher, 'Drupal\filter\Annotation\Filter');
     $this->alterInfo('filter_info');
     $this->setCacheBackend($cache_backend, 'filter_plugins', array('filter_formats' => TRUE));
   }
diff --git a/core/modules/image/src/ImageEffectManager.php b/core/modules/image/src/ImageEffectManager.php
index 4885450..02901f7 100644
--- a/core/modules/image/src/ImageEffectManager.php
+++ b/core/modules/image/src/ImageEffectManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages image effect plugins.
@@ -26,9 +27,11 @@ class ImageEffectManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/ImageEffect', $namespaces, $module_handler, 'Drupal\image\Annotation\ImageEffect');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/ImageEffect', $namespaces, $module_handler, $event_dispatcher, 'Drupal\image\Annotation\ImageEffect');
 
     $this->alterInfo('image_effect_info');
     $this->setCacheBackend($cache_backend, 'image_effect_plugins');
diff --git a/core/modules/language/language.services.yml b/core/modules/language/language.services.yml
index 9b5b2f4..7cc509e 100644
--- a/core/modules/language/language.services.yml
+++ b/core/modules/language/language.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.language_negotiation_method:
     class: Drupal\language\LanguageNegotiationMethodManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   language_negotiator:
     class: Drupal\language\LanguageNegotiator
     arguments: ['@language_manager', '@plugin.manager.language_negotiation_method', '@config.factory', '@settings', '@request_stack']
diff --git a/core/modules/language/src/LanguageNegotiationMethodManager.php b/core/modules/language/src/LanguageNegotiationMethodManager.php
index 681c67c..052f59a 100644
--- a/core/modules/language/src/LanguageNegotiationMethodManager.php
+++ b/core/modules/language/src/LanguageNegotiationMethodManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages language negotiation methods.
@@ -26,9 +27,11 @@ class LanguageNegotiationMethodManager extends DefaultPluginManager {
    *   An object that implements CacheBackendInterface
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   An object that implements ModuleHandlerInterface
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/LanguageNegotiation', $namespaces, $module_handler);
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/LanguageNegotiation', $namespaces, $module_handler, $event_dispatcher);
     $this->cacheBackend = $cache_backend;
     $this->cacheKeyPrefix = 'language_negotiation_plugins';
     $this->cacheKey = 'language_negotiation_plugins';
diff --git a/core/modules/migrate/migrate.services.yml b/core/modules/migrate/migrate.services.yml
index e51e1f3..a62a214 100644
--- a/core/modules/migrate/migrate.services.yml
+++ b/core/modules/migrate/migrate.services.yml
@@ -8,19 +8,19 @@ services:
     arguments: [migrate]
   plugin.manager.migrate.source:
     class: Drupal\migrate\Plugin\MigratePluginManager
-    arguments: [source, '@container.namespaces', '@cache.discovery', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource']
+    arguments: [source, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', 'Drupal\migrate\Annotation\MigrateSource']
   plugin.manager.migrate.process:
     class: Drupal\migrate\Plugin\MigratePluginManager
-    arguments: [process, '@container.namespaces', '@cache.discovery', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
+    arguments: [process, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
   plugin.manager.migrate.destination:
     class: Drupal\migrate\Plugin\MigrateDestinationPluginManager
-    arguments: [destination, '@container.namespaces', '@cache.discovery', '@module_handler', '@entity.manager']
+    arguments: [destination, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher', '@entity.manager']
   plugin.manager.migrate.id_map:
     class: Drupal\migrate\Plugin\MigratePluginManager
-    arguments: [id_map, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [id_map, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.migrate.entity_field:
     class: Drupal\migrate\Plugin\MigratePluginManager
-    arguments: [entity_field, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [entity_field, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   password_migrate:
     class: Drupal\migrate\MigratePassword
     arguments: ['@password_original']
diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
index b8f187d..c513874 100644
--- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\migrate\Entity\MigrationInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin manager for migrate destination plugins.
@@ -42,8 +43,8 @@ class MigrateDestinationPluginManager extends MigratePluginManager {
   /**
    * {@inheritdoc}
    */
-  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') {
-    parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation);
+  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') {
+    parent::__construct($type, $namespaces, $cache_backend, $module_handler, $event_dispatcher, $annotation);
     $this->entityManager = $entity_manager;
   }
 
diff --git a/core/modules/migrate/src/Plugin/MigratePluginManager.php b/core/modules/migrate/src/Plugin/MigratePluginManager.php
index 0ae77be..ca986dc 100644
--- a/core/modules/migrate/src/Plugin/MigratePluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigratePluginManager.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\migrate\Entity\MigrationInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages migrate plugins.
@@ -42,11 +43,13 @@ class MigratePluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    * @param string $annotation
    *   The annotation class name.
    */
-  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\Component\Annotation\PluginID') {
-    parent::__construct("Plugin/migrate/$type", $namespaces, $module_handler, $annotation);
+  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, $annotation = 'Drupal\Component\Annotation\PluginID') {
+    parent::__construct("Plugin/migrate/$type", $namespaces, $module_handler, $event_dispatcher,$annotation);
     $this->alterInfo('migrate_' . $type . '_info');
     $this->setCacheBackend($cache_backend, 'migrate_plugins_' . $type);
   }
diff --git a/core/modules/migrate_drupal/migrate_drupal.services.yml b/core/modules/migrate_drupal/migrate_drupal.services.yml
index 6dd03c0..05f2ea4 100644
--- a/core/modules/migrate_drupal/migrate_drupal.services.yml
+++ b/core/modules/migrate_drupal/migrate_drupal.services.yml
@@ -1,4 +1,4 @@
 services:
   plugin.manager.migrate.load:
     class: Drupal\migrate\Plugin\MigratePluginManager
-    arguments: [load, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [load, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
diff --git a/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php b/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php
index 876da2d..3d126b4 100644
--- a/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php
+++ b/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides an in-place editor manager.
@@ -33,9 +34,11 @@ class InPlaceEditorManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/InPlaceEditor', $namespaces, $module_handler, 'Drupal\quickedit\Annotation\InPlaceEditor');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/InPlaceEditor', $namespaces, $module_handler, $event_dispatcher, 'Drupal\quickedit\Annotation\InPlaceEditor');
     $this->alterInfo('quickedit_editor');
     $this->setCacheBackend($cache_backend, 'quickedit:editor');
   }
diff --git a/core/modules/rest/rest.services.yml b/core/modules/rest/rest.services.yml
index 6172047..a6d2a24 100644
--- a/core/modules/rest/rest.services.yml
+++ b/core/modules/rest/rest.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.rest:
     class: Drupal\rest\Plugin\Type\ResourcePluginManager
-    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   cache.rest:
     class: Drupal\Core\Cache\CacheBackendInterface
     tags:
diff --git a/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php b/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
index ec9cb9f..cc727f2 100644
--- a/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
+++ b/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Manages discovery and instantiation of resource plugins.
@@ -31,9 +32,11 @@ class ResourcePluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/rest/resource', $namespaces, $module_handler, 'Drupal\rest\Annotation\RestResource');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/rest/resource', $namespaces, $module_handler, $event_dispatcher, 'Drupal\rest\Annotation\RestResource');
 
     $this->setCacheBackend($cache_backend, 'rest_plugins');
     $this->alterInfo('rest_resource');
diff --git a/core/modules/search/src/SearchPluginManager.php b/core/modules/search/src/SearchPluginManager.php
index 5670e71..4c60b05 100644
--- a/core/modules/search/src/SearchPluginManager.php
+++ b/core/modules/search/src/SearchPluginManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\Core\Cache\CacheBackendInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * SearchExecute plugin manager.
@@ -26,9 +27,11 @@ class SearchPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/Search', $namespaces, $module_handler, 'Drupal\search\Annotation\SearchPlugin');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/Search', $namespaces, $module_handler, $event_dispatcher, 'Drupal\search\Annotation\SearchPlugin');
     $this->setCacheBackend($cache_backend, 'search_plugins');
     $this->alterInfo('search_plugin');
   }
diff --git a/core/modules/system/src/Entity/Menu.php b/core/modules/system/src/Entity/Menu.php
index a1848bb..0580bc4 100644
--- a/core/modules/system/src/Entity/Menu.php
+++ b/core/modules/system/src/Entity/Menu.php
@@ -64,4 +64,17 @@ public function isLocked() {
     return (bool) $this->locked;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function postDelete(EntityStorageInterface $storage, array $entities) {
+    parent::postDelete($storage, $entities);
+
+    foreach ($entities as $entity) {
+      /** @var \Drupal\block\BlockManagerInterface $block_manager */
+      $block_manager = \Drupal::service('plugin.manager.block');
+      $block_manager->removePluginId('menu_menu_block:' . $entity->id());
+    }
+  }
+
 }
diff --git a/core/modules/system/tests/modules/condition_test/src/FormController.php b/core/modules/system/tests/modules/condition_test/src/FormController.php
index 1f13755..70429e7 100644
--- a/core/modules/system/tests/modules/condition_test/src/FormController.php
+++ b/core/modules/system/tests/modules/condition_test/src/FormController.php
@@ -34,7 +34,7 @@ public function getFormId() {
    * Constructs a \Drupal\condition_test\FormController object.
    */
   public function __construct() {
-    $manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('discovery'), \Drupal::moduleHandler());
+    $manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('discovery'), \Drupal::moduleHandler(), \Drupal::service('event_dispatcher'));
     $this->condition = $manager->createInstance('node_type');
   }
 
diff --git a/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php b/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php
index e81c39e..ed68069 100644
--- a/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php
+++ b/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php
@@ -11,6 +11,7 @@
 use Drupal\Component\Plugin\Factory\DefaultFactory;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Defines a plugin manager used by Plugin API unit tests.
@@ -22,8 +23,10 @@ class DefaultsTestPluginManager extends DefaultPluginManager {
   *
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
+  * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+  *   The event dispatcher.
   */
-  public function __construct(ModuleHandlerInterface $module_handler) {
+  public function __construct(ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     // Create the object that can be used to return definitions for all the
     // plugins available for this type. Most real plugin managers use a richer
     // discovery implementation, but StaticDiscovery lets us add some simple
@@ -31,6 +34,7 @@ public function __construct(ModuleHandlerInterface $module_handler) {
     $this->discovery = new StaticDiscovery();
     $this->factory = new DefaultFactory($this);
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
 
     // Specify default values.
     $this->defaults = array(
diff --git a/core/modules/tour/src/TipPluginManager.php b/core/modules/tour/src/TipPluginManager.php
index 6f98f62..b4b4002 100644
--- a/core/modules/tour/src/TipPluginManager.php
+++ b/core/modules/tour/src/TipPluginManager.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Provides a plugin manager for tour items.
@@ -31,9 +32,11 @@ class TipPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/tour/tip', $namespaces, $module_handler, 'Drupal\tour\Annotation\Tip');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
+    parent::__construct('Plugin/tour/tip', $namespaces, $module_handler, $event_dispatcher, 'Drupal\tour\Annotation\Tip');
 
     $this->alterInfo('tour_tips_info');
     $this->setCacheBackend($cache_backend, 'tour_plugins');
diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php
index 7b7b76e..a222526 100644
--- a/core/modules/views/src/Plugin/ViewsHandlerManager.php
+++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php
@@ -13,6 +13,7 @@
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Drupal\views\ViewsData;
 use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin type manager for all views handlers.
@@ -49,10 +50,12 @@ class ViewsHandlerManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($handler_type);
-    parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, $plugin_definition_annotation_name);
+    parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, $event_dispatcher,$plugin_definition_annotation_name);
 
     $this->setCacheBackend($cache_backend, "views:$handler_type", array('extension' => array(TRUE, 'views')));
 
diff --git a/core/modules/views/src/Plugin/ViewsPluginManager.php b/core/modules/views/src/Plugin/ViewsPluginManager.php
index ca98555..7436e4d 100644
--- a/core/modules/views/src/Plugin/ViewsPluginManager.php
+++ b/core/modules/views/src/Plugin/ViewsPluginManager.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
 use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * Plugin type manager for all views plugins.
@@ -31,10 +32,12 @@ class ViewsPluginManager extends DefaultPluginManager {
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   The event dispatcher.
    */
-  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
+  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher) {
     $plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($type);
-    parent::__construct("Plugin/views/$type", $namespaces, $module_handler, $plugin_definition_annotation_name);
+    parent::__construct("Plugin/views/$type", $namespaces, $module_handler, $event_dispatcher, $plugin_definition_annotation_name);
 
     $this->defaults += array(
       'parent' => 'parent',
diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml
index b66568f..92059dd 100644
--- a/core/modules/views/views.services.yml
+++ b/core/modules/views/views.services.yml
@@ -1,61 +1,61 @@
 services:
   plugin.manager.views.access:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [access, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [access, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.area:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.argument:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.argument_default:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [argument_default, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [argument_default, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.argument_validator:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [argument_validator, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [argument_validator, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.cache:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [cache, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [cache, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.display_extender:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [display_extender, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [display_extender, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.display:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [display, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [display, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.exposed_form:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [exposed_form, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [exposed_form, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.field:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.filter:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.join:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.pager:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [pager, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [pager, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.query:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [query, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [query, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.relationship:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.row:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [row, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [row, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.sort:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler']
+    arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.style:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [style, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [style, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   plugin.manager.views.wizard:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [wizard, '@container.namespaces', '@cache.discovery', '@module_handler']
+    arguments: [wizard, '@container.namespaces', '@cache.discovery', '@module_handler', '@event_dispatcher']
   views.views_data:
     class: Drupal\views\ViewsData
     arguments: ['@cache.discovery', '@config.factory', '@module_handler', '@language_manager']
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
index 6022ecf..819d4ed 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
@@ -93,6 +93,13 @@ class EntityManagerTest extends UnitTestCase {
   protected $typedDataManager;
 
   /**
+   * The mocked event dispatcher.
+   *
+   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
+   */
+  protected $eventDispatcher;
+
+  /**
    * {@inheritdoc}
    */
   protected function setUp() {
@@ -103,6 +110,7 @@ protected function setUp() {
       ->method('getImplementations')
       ->with('entity_type_build')
       ->will($this->returnValue(array()));
+    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
 
     $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
 
@@ -156,7 +164,7 @@ protected function setUpEntityManager($definitions = array()) {
       ->method('getDefinitions')
       ->will($this->returnValue($definitions));
 
-    $this->entityManager = new TestEntityManager(new \ArrayObject(), $this->moduleHandler, $this->cache, $this->languageManager, $this->translationManager, $this->getClassResolverStub(), $this->typedDataManager);
+    $this->entityManager = new TestEntityManager(new \ArrayObject(), $this->moduleHandler, $this->eventDispatcher, $this->cache, $this->languageManager, $this->translationManager, $this->getClassResolverStub(), $this->typedDataManager);
     $this->entityManager->setContainer($this->container);
     $this->entityManager->setDiscovery($this->discovery);
   }
diff --git a/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php b/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php
index ca0583f..11956bd 100644
--- a/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php
@@ -40,10 +40,12 @@ public function setUp() {
       ->method('moduleExists')
       ->with($module_name)
       ->will($this->returnValue(TRUE));
+    $event_dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
     $plugin_manager = new FieldTypePluginManager(
       $namespaces,
       $this->getMock('Drupal\Core\Cache\CacheBackendInterface'),
-      $module_handler
+      $module_handler,
+      $event_dispatcher
     );
 
     $container = new ContainerBuilder();
diff --git a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
index 7d19b8a..3fb9be6 100644
--- a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
@@ -52,6 +52,13 @@ class MailManagerTest extends UnitTestCase {
   protected $mailManager;
 
   /**
+   * The mocked event dispatcher.
+   *
+   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
+   */
+  protected $eventDispatcher;
+
+  /**
    * A list of mail plugin definitions.
    *
    * @var array
@@ -76,6 +83,7 @@ protected function setUp() {
     $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
 
     $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
 
     // Mock a Discovery object to replace AnnotationClassDiscovery.
     $this->discovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
@@ -97,7 +105,7 @@ protected function setUpMailManager($interface = array()) {
     $logger_factory = $this->getMock('\Drupal\Core\Logger\LoggerChannelFactoryInterface');
     $string_translation = $this->getStringTranslationStub();
     // Construct the manager object and override its discovery.
-    $this->mailManager = new TestMailManager(new \ArrayObject(), $this->cache, $this->moduleHandler, $this->configFactory, $logger_factory, $string_translation);
+    $this->mailManager = new TestMailManager(new \ArrayObject(), $this->cache, $this->moduleHandler, $this->eventDispatcher, $this->configFactory, $logger_factory, $string_translation);
     $this->mailManager->setDiscovery($this->discovery);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
index f92711a..bb012b0 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
@@ -17,6 +17,7 @@
 use Drupal\Core\Routing\RouteProviderInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\UnitTestCase;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
@@ -91,6 +92,13 @@ class LocalActionManagerTest extends UnitTestCase {
   protected $discovery;
 
   /**
+   * The mocked event dispatcher.
+   *
+   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
+   */
+  protected $eventDispatcher;
+
+  /**
    * The tested local action manager
    *
    * @var \Drupal\Tests\Core\Menu\TestLocalActionManager
@@ -105,6 +113,7 @@ protected function setUp() {
     $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request');
     $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
     $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
     $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
 
     $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
@@ -112,7 +121,7 @@ protected function setUp() {
     $this->discovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface');
     $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface');
 
-    $this->localActionManager = new TestLocalActionManager($this->controllerResolver, $this->request, $this->routeProvider, $this->moduleHandler, $this->cacheBackend, $this->accessManager, $this->account, $this->discovery, $this->factory);
+    $this->localActionManager = new TestLocalActionManager($this->controllerResolver, $this->request, $this->routeProvider, $this->moduleHandler, $this->eventDispatcher,$this->cacheBackend, $this->accessManager, $this->account, $this->discovery, $this->factory);
   }
 
   /**
@@ -341,7 +350,7 @@ public function getActionsForRouteProvider() {
 
 class TestLocalActionManager extends LocalActionManager {
 
-  public function __construct(ControllerResolverInterface $controller_resolver, Request $request, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, AccessManagerInterface $access_manager, AccountInterface $account, DiscoveryInterface $discovery, FactoryInterface $factory) {
+  public function __construct(ControllerResolverInterface $controller_resolver, Request $request, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, CacheBackendInterface $cache_backend, AccessManagerInterface $access_manager, AccountInterface $account, DiscoveryInterface $discovery, FactoryInterface $factory) {
     $this->discovery = $discovery;
     $this->factory = $factory;
     $this->routeProvider = $route_provider;
@@ -351,6 +360,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re
     $this->requestStack = new RequestStack();
     $this->requestStack->push($request);
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
     $this->alterInfo('menu_local_actions');
     $this->setCacheBackend($cache_backend, 'local_action_plugins', array('local_action' => TRUE));
   }
diff --git a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
index a7ea79d..78c438c 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
@@ -10,6 +10,7 @@
 use Drupal\Component\Plugin\Discovery\StaticDiscovery;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
 /**
  * A plugin manager for condition plugins.
@@ -28,8 +29,10 @@ class TestPluginManager extends DefaultPluginManager {
    *   (optional) The module handler to invoke the alter hook with.
    * @param string $alter_hook
    *   (optional) Name of the alter hook.
+   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
+   *   (optional) The event dispatcher.
    */
-  public function __construct(\Traversable $namespaces, array $definitions, ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL) {
+  public function __construct(\Traversable $namespaces, array $definitions, ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL, EventDispatcherInterface $event_dispatcher = NULL) {
     // Create the object that can be used to return definitions for all the
     // plugins available for this type. Most real plugin managers use a richer
     // discovery implementation, but StaticDiscovery lets us add some simple
@@ -42,6 +45,7 @@ public function __construct(\Traversable $namespaces, array $definitions, Module
     }
 
     $this->moduleHandler = $module_handler;
+    $this->eventDispatcher = $event_dispatcher;
 
     if ($alter_hook) {
       $this->alterInfo($alter_hook);
diff --git a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php
index fa9cbb3..c66fbf9 100644
--- a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php
@@ -31,6 +31,13 @@ class ElementInfoManagerTest extends UnitTestCase {
   protected $cache;
 
   /**
+   * The mocked event dispatcher.
+   *
+   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
+   */
+  protected $eventDispatcher;
+
+  /**
    * The mocked module handler.
    *
    * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -45,8 +52,9 @@ class ElementInfoManagerTest extends UnitTestCase {
   protected function setUp() {
     $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
     $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+    $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
 
-    $this->elementInfo = new ElementInfoManager(new \ArrayObject(), $this->cache, $this->moduleHandler);
+    $this->elementInfo = new ElementInfoManager(new \ArrayObject(), $this->cache, $this->moduleHandler, $this->eventDispatcher);
   }
 
   /**
@@ -149,7 +157,7 @@ public function testGetInfoElementPlugin($plugin_class, $expected_info) {
       ));
 
     $element_info = $this->getMockBuilder('Drupal\Core\Render\ElementInfoManager')
-      ->setConstructorArgs(array(new \ArrayObject(), $this->cache, $this->moduleHandler))
+      ->setConstructorArgs(array(new \ArrayObject(), $this->cache, $this->moduleHandler, $this->eventDispatcher))
       ->setMethods(array('getDefinitions', 'createInstance'))
       ->getMock();
     $element_info->expects($this->once())
