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

Unified Diff: content/browser/shared_worker/shared_worker_host.cc

Issue 187553002: Tells the crash of SharedWorker to RenderViewHosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/shared_worker/shared_worker_host.cc
diff --git a/content/browser/shared_worker/shared_worker_host.cc b/content/browser/shared_worker/shared_worker_host.cc
index 6666bf37d6319042c9484ce8496810adb8363e1b..716443a95c329b05c919ab70b98db90a658e1c06 100644
--- a/content/browser/shared_worker/shared_worker_host.cc
+++ b/content/browser/shared_worker/shared_worker_host.cc
@@ -4,6 +4,8 @@
#include "content/browser/shared_worker/shared_worker_host.h"
+#include "content/browser/frame_host/render_frame_host_delegate.h"
+#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/message_port_service.h"
#include "content/browser/shared_worker/shared_worker_instance.h"
#include "content/browser/shared_worker/shared_worker_message_filter.h"
@@ -12,6 +14,17 @@
#include "content/public/browser/browser_thread.h"
namespace content {
+namespace {
+
+// Notifies RenderViewHost that one or more worker objects crashed.
+void WorkerCrashCallback(int render_process_unique_id, int render_frame_id) {
+ RenderFrameHostImpl* host =
+ RenderFrameHostImpl::FromID(render_process_unique_id, render_frame_id);
+ if (host)
+ host->delegate()->WorkerCrashed(host);
+}
+
+} // namespace
SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance)
: instance_(instance),
@@ -22,6 +35,21 @@ SharedWorkerHost::SharedWorkerHost(SharedWorkerInstance* instance)
SharedWorkerHost::~SharedWorkerHost() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ // If we crashed, tell the RenderViewHosts.
+ if (instance_ && !instance_->load_failed()) {
+ const WorkerDocumentSet::DocumentInfoSet& parents =
+ instance_->worker_document_set()->documents();
+ for (WorkerDocumentSet::DocumentInfoSet::const_iterator parent_iter =
+ parents.begin();
+ parent_iter != parents.end();
+ ++parent_iter) {
+ BrowserThread::PostTask(BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&WorkerCrashCallback,
+ parent_iter->render_process_id(),
+ parent_iter->render_frame_id()));
+ }
+ }
}
bool SharedWorkerHost::Send(IPC::Message* message) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698