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

Side by Side Diff: content/renderer/shared_worker_repository.cc

Issue 2604733002: SharedWorker: Make shared workers keyed by a pair of url and name (Closed)
Patch Set: clean up Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/shared_worker_repository.h" 5 #include "content/renderer/shared_worker_repository.h"
6 6
7 #include "content/child/child_thread_impl.h" 7 #include "content/child/child_thread_impl.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_frame_impl.h" 9 #include "content/renderer/render_frame_impl.h"
10 #include "content/renderer/websharedworker_proxy.h" 10 #include "content/renderer/websharedworker_proxy.h"
(...skipping 24 matching lines...) Expand all
35 params.name = name.utf16(); 35 params.name = name.utf16();
36 params.content_security_policy = content_security_policy.utf16(); 36 params.content_security_policy = content_security_policy.utf16();
37 params.security_policy_type = security_policy_type; 37 params.security_policy_type = security_policy_type;
38 params.document_id = document_id; 38 params.document_id = document_id;
39 params.render_frame_route_id = render_frame()->GetRoutingID(); 39 params.render_frame_route_id = render_frame()->GetRoutingID();
40 params.creation_address_space = creation_address_space; 40 params.creation_address_space = creation_address_space;
41 params.creation_context_type = creation_context_type; 41 params.creation_context_type = creation_context_type;
42 ViewHostMsg_CreateWorker_Reply reply; 42 ViewHostMsg_CreateWorker_Reply reply;
43 Send(new ViewHostMsg_CreateWorker(params, &reply)); 43 Send(new ViewHostMsg_CreateWorker(params, &reply));
44 *error = reply.error; 44 *error = reply.error;
45 if (reply.route_id == MSG_ROUTING_NONE)
46 return nullptr;
47 documents_with_workers_.insert(document_id); 45 documents_with_workers_.insert(document_id);
48 return base::MakeUnique<WebSharedWorkerProxy>( 46 return base::MakeUnique<WebSharedWorkerProxy>(
49 ChildThreadImpl::current()->GetRouter(), reply.route_id); 47 ChildThreadImpl::current()->GetRouter(), reply.route_id);
50 } 48 }
51 49
52 void SharedWorkerRepository::documentDetached(DocumentID document) { 50 void SharedWorkerRepository::documentDetached(DocumentID document) {
53 std::set<DocumentID>::iterator iter = documents_with_workers_.find(document); 51 std::set<DocumentID>::iterator iter = documents_with_workers_.find(document);
54 if (iter != documents_with_workers_.end()) { 52 if (iter != documents_with_workers_.end()) {
55 // Notify the browser process that the document has shut down. 53 // Notify the browser process that the document has shut down.
56 Send(new ViewHostMsg_DocumentDetached(document)); 54 Send(new ViewHostMsg_DocumentDetached(document));
57 documents_with_workers_.erase(iter); 55 documents_with_workers_.erase(iter);
58 } 56 }
59 } 57 }
60 58
61 void SharedWorkerRepository::OnDestruct() { 59 void SharedWorkerRepository::OnDestruct() {
62 delete this; 60 delete this;
63 } 61 }
64 62
65 } // namespace content 63 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_service_impl_unittest.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698