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

Side by Side Diff: Source/core/dom/MessagePort.h

Issue 16904002: Avoid leaking objects between isolated worlds via attribute event listeners (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/EventTarget.cpp ('k') | Source/core/page/DOMWindow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 virtual const AtomicString& interfaceName() const OVERRIDE; 75 virtual const AtomicString& interfaceName() const OVERRIDE;
76 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; 76 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
77 77
78 void dispatchMessages(); 78 void dispatchMessages();
79 79
80 using RefCounted<MessagePort>::ref; 80 using RefCounted<MessagePort>::ref;
81 using RefCounted<MessagePort>::deref; 81 using RefCounted<MessagePort>::deref;
82 82
83 bool hasPendingActivity(); 83 bool hasPendingActivity();
84 84
85 void setOnmessage(PassRefPtr<EventListener> listener) 85 void setOnmessage(PassRefPtr<EventListener> listener, DOMWrapperWorld* world )
86 { 86 {
87 setAttributeEventListener(eventNames().messageEvent, listener); 87 setAttributeEventListener(eventNames().messageEvent, listener, world);
88 start(); 88 start();
89 } 89 }
90 EventListener* onmessage() { return getAttributeEventListener(eventNames().m essageEvent); } 90 EventListener* onmessage(DOMWrapperWorld* world) { return getAttributeEventL istener(eventNames().messageEvent, world); }
91 91
92 // Returns null if there is no entangled port, or if the entangled port is r un by a different thread. 92 // Returns null if there is no entangled port, or if the entangled port is r un by a different thread.
93 // This is used solely to enable a GC optimization. Some platforms may not b e able to determine ownership 93 // This is used solely to enable a GC optimization. Some platforms may not b e able to determine ownership
94 // of the remote port (since it may live cross-process) - those platforms ma y always return null. 94 // of the remote port (since it may live cross-process) - those platforms ma y always return null.
95 MessagePort* locallyEntangledPort(); 95 MessagePort* locallyEntangledPort();
96 96
97 // A port starts out its life entangled, and remains entangled until it is c losed or is cloned. 97 // A port starts out its life entangled, and remains entangled until it is c losed or is cloned.
98 bool isEntangled() { return !m_closed && !isNeutered(); } 98 bool isEntangled() { return !m_closed && !isNeutered(); }
99 99
100 // A port gets neutered when it is transferred to a new owner via postMessag e(). 100 // A port gets neutered when it is transferred to a new owner via postMessag e().
(...skipping 12 matching lines...) Expand all
113 bool m_started; 113 bool m_started;
114 bool m_closed; 114 bool m_closed;
115 115
116 ScriptExecutionContext* m_scriptExecutionContext; 116 ScriptExecutionContext* m_scriptExecutionContext;
117 EventTargetData m_eventTargetData; 117 EventTargetData m_eventTargetData;
118 }; 118 };
119 119
120 } // namespace WebCore 120 } // namespace WebCore
121 121
122 #endif // MessagePort_h 122 #endif // MessagePort_h
OLDNEW
« no previous file with comments | « Source/core/dom/EventTarget.cpp ('k') | Source/core/page/DOMWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698