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

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

Issue 924983002: Expose v8 context a MessagePort lives in to give content side code a valid context to (de)serialize… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use v8::Local instead of v8::Handle Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/dom/MessagePort.cpp » ('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 25 matching lines...) Expand all
36 #include "wtf/PassOwnPtr.h" 36 #include "wtf/PassOwnPtr.h"
37 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
38 #include "wtf/RefCounted.h" 38 #include "wtf/RefCounted.h"
39 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
40 #include "wtf/Vector.h" 40 #include "wtf/Vector.h"
41 #include "wtf/WeakPtr.h" 41 #include "wtf/WeakPtr.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class ExceptionState; 45 class ExceptionState;
46 class ExecutionContext;
46 class MessagePort; 47 class MessagePort;
47 class ExecutionContext; 48 class ScriptState;
48 class SerializedScriptValue; 49 class SerializedScriptValue;
49 50
50 // The overwhelmingly common case is sending a single port, so handle that effic iently with an inline buffer of size 1. 51 // The overwhelmingly common case is sending a single port, so handle that effic iently with an inline buffer of size 1.
51 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; 52 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray;
52 53
53 // Not to be confused with WebMessagePortChannelArray; this one uses Vector and OwnPtr instead of WebVector and raw pointers. 54 // Not to be confused with WebMessagePortChannelArray; this one uses Vector and OwnPtr instead of WebVector and raw pointers.
54 typedef Vector<OwnPtr<WebMessagePortChannel>, 1> MessagePortChannelArray; 55 typedef Vector<OwnPtr<WebMessagePortChannel>, 1> MessagePortChannelArray;
55 56
56 class MessagePort final 57 class MessagePort final
57 : public EventTargetWithInlineData 58 : public EventTargetWithInlineData
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // A port gets neutered when it is transferred to a new owner via postMessag e(). 106 // A port gets neutered when it is transferred to a new owner via postMessag e().
106 bool isNeutered() const { return !m_entangledChannel; } 107 bool isNeutered() const { return !m_entangledChannel; }
107 108
108 DECLARE_VIRTUAL_TRACE(); 109 DECLARE_VIRTUAL_TRACE();
109 110
110 private: 111 private:
111 explicit MessagePort(ExecutionContext&); 112 explicit MessagePort(ExecutionContext&);
112 113
113 // WebMessagePortChannelClient implementation. 114 // WebMessagePortChannelClient implementation.
114 virtual void messageAvailable() override; 115 virtual void messageAvailable() override;
116 virtual v8::Isolate* scriptIsolate() override;
117 virtual v8::Local<v8::Context> scriptContextForMessageConversion() override;
115 void dispatchMessages(); 118 void dispatchMessages();
116 119
117 OwnPtr<WebMessagePortChannel> m_entangledChannel; 120 OwnPtr<WebMessagePortChannel> m_entangledChannel;
118 121
119 bool m_started; 122 bool m_started;
120 bool m_closed; 123 bool m_closed;
121 124
122 WeakPtrFactory<MessagePort> m_weakFactory; 125 WeakPtrFactory<MessagePort> m_weakFactory;
126
127 RefPtr<ScriptState> m_scriptStateForConversion;
123 }; 128 };
124 129
125 } // namespace blink 130 } // namespace blink
126 131
127 #endif // MessagePort_h 132 #endif // MessagePort_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/MessagePort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698