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

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

Issue 1219063013: Fix virtual/override/final usage in Source/core/dom/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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/MainThreadTaskRunnerTest.cpp ('k') | Source/core/dom/MutationRecord.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 class CORE_EXPORT MessagePort 58 class CORE_EXPORT MessagePort
59 : public EventTargetWithInlineData 59 : public EventTargetWithInlineData
60 , public RefCountedWillBeNoBase<MessagePort> 60 , public RefCountedWillBeNoBase<MessagePort>
61 , public ActiveDOMObject 61 , public ActiveDOMObject
62 , public WebMessagePortChannelClient { 62 , public WebMessagePortChannelClient {
63 DEFINE_WRAPPERTYPEINFO(); 63 DEFINE_WRAPPERTYPEINFO();
64 REFCOUNTED_EVENT_TARGET(MessagePort); 64 REFCOUNTED_EVENT_TARGET(MessagePort);
65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MessagePort); 65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MessagePort);
66 public: 66 public:
67 static PassRefPtrWillBeRawPtr<MessagePort> create(ExecutionContext&); 67 static PassRefPtrWillBeRawPtr<MessagePort> create(ExecutionContext&);
68 virtual ~MessagePort(); 68 ~MessagePort() override;
69 69
70 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&); 70 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&);
71 71
72 void start(); 72 void start();
73 void close(); 73 void close();
74 74
75 void entangle(PassOwnPtr<WebMessagePortChannel>); 75 void entangle(PassOwnPtr<WebMessagePortChannel>);
76 PassOwnPtr<WebMessagePortChannel> disentangle(); 76 PassOwnPtr<WebMessagePortChannel> disentangle();
77 77
78 static PassOwnPtr<WebMessagePortChannelArray> toWebMessagePortChannelArray(P assOwnPtr<MessagePortChannelArray>); 78 static PassOwnPtr<WebMessagePortChannelArray> toWebMessagePortChannelArray(P assOwnPtr<MessagePortChannelArray>);
79 static PassOwnPtrWillBeRawPtr<MessagePortArray> toMessagePortArray(Execution Context*, const WebMessagePortChannelArray&); 79 static PassOwnPtrWillBeRawPtr<MessagePortArray> toMessagePortArray(Execution Context*, const WebMessagePortChannelArray&);
80 80
81 // Returns 0 if there is an exception, or if the passed-in array is 0/empty. 81 // Returns 0 if there is an exception, or if the passed-in array is 0/empty.
82 static PassOwnPtr<MessagePortChannelArray> disentanglePorts(ExecutionContext *, const MessagePortArray*, ExceptionState&); 82 static PassOwnPtr<MessagePortChannelArray> disentanglePorts(ExecutionContext *, const MessagePortArray*, ExceptionState&);
83 83
84 // Returns 0 if the passed array is 0/empty. 84 // Returns 0 if the passed array is 0/empty.
85 static PassOwnPtrWillBeRawPtr<MessagePortArray> entanglePorts(ExecutionConte xt&, PassOwnPtr<MessagePortChannelArray>); 85 static PassOwnPtrWillBeRawPtr<MessagePortArray> entanglePorts(ExecutionConte xt&, PassOwnPtr<MessagePortChannelArray>);
86 86
87 bool started() const { return m_started; } 87 bool started() const { return m_started; }
88 88
89 virtual const AtomicString& interfaceName() const override; 89 const AtomicString& interfaceName() const override;
90 virtual ExecutionContext* executionContext() const override { return ActiveD OMObject::executionContext(); } 90 ExecutionContext* executionContext() const override { return ActiveDOMObject ::executionContext(); }
91 virtual MessagePort* toMessagePort() override { return this; } 91 MessagePort* toMessagePort() override { return this; }
92 92
93 // ActiveDOMObject implementation. 93 // ActiveDOMObject implementation.
94 virtual bool hasPendingActivity() const override; 94 bool hasPendingActivity() const override;
95 virtual void stop() override { close(); } 95 void stop() override { close(); }
96 96
97 void setOnmessage(PassRefPtr<EventListener> listener) 97 void setOnmessage(PassRefPtr<EventListener> listener)
98 { 98 {
99 setAttributeEventListener(EventTypeNames::message, listener); 99 setAttributeEventListener(EventTypeNames::message, listener);
100 start(); 100 start();
101 } 101 }
102 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames ::message); } 102 EventListener* onmessage() { return getAttributeEventListener(EventTypeNames ::message); }
103 103
104 // A port starts out its life entangled, and remains entangled until it is c losed or is cloned. 104 // A port starts out its life entangled, and remains entangled until it is c losed or is cloned.
105 bool isEntangled() const { return !m_closed && !isNeutered(); } 105 bool isEntangled() const { return !m_closed && !isNeutered(); }
106 106
107 // A port gets neutered when it is transferred to a new owner via postMessag e(). 107 // A port gets neutered when it is transferred to a new owner via postMessag e().
108 bool isNeutered() const { return !m_entangledChannel; } 108 bool isNeutered() const { return !m_entangledChannel; }
109 109
110 DECLARE_VIRTUAL_TRACE(); 110 DECLARE_VIRTUAL_TRACE();
111 111
112 protected: 112 protected:
113 explicit MessagePort(ExecutionContext&); 113 explicit MessagePort(ExecutionContext&);
114 bool tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePor tChannelArray>& channels); 114 bool tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePor tChannelArray>& channels);
115 115
116 private: 116 private:
117 // WebMessagePortChannelClient implementation. 117 // WebMessagePortChannelClient implementation.
118 virtual void messageAvailable() override; 118 void messageAvailable() override;
119 virtual v8::Isolate* scriptIsolate() override; 119 v8::Isolate* scriptIsolate() override;
120 virtual v8::Local<v8::Context> scriptContextForMessageConversion() override; 120 v8::Local<v8::Context> scriptContextForMessageConversion() override;
121 void dispatchMessages(); 121 void dispatchMessages();
122 122
123 OwnPtr<WebMessagePortChannel> m_entangledChannel; 123 OwnPtr<WebMessagePortChannel> m_entangledChannel;
124 124
125 bool m_started; 125 bool m_started;
126 bool m_closed; 126 bool m_closed;
127 127
128 WeakPtrFactory<MessagePort> m_weakFactory; 128 WeakPtrFactory<MessagePort> m_weakFactory;
129 129
130 RefPtr<ScriptState> m_scriptStateForConversion; 130 RefPtr<ScriptState> m_scriptStateForConversion;
131 }; 131 };
132 132
133 } // namespace blink 133 } // namespace blink
134 134
135 #endif // MessagePort_h 135 #endif // MessagePort_h
OLDNEW
« no previous file with comments | « Source/core/dom/MainThreadTaskRunnerTest.cpp ('k') | Source/core/dom/MutationRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698