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

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

Issue 2390543002: Reflow comments in core/dom/. (Closed)
Patch Set: Reformat comments in core/dom/. Created 4 years, 2 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 /* 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 30 matching lines...) Expand all
41 #include <memory> 41 #include <memory>
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class ExceptionState; 45 class ExceptionState;
46 class ExecutionContext; 46 class ExecutionContext;
47 class MessagePort; 47 class MessagePort;
48 class ScriptState; 48 class ScriptState;
49 class SerializedScriptValue; 49 class SerializedScriptValue;
50 50
51 // Not to be confused with WebMessagePortChannelArray; this one uses Vector and std::unique_ptr instead of WebVector and raw pointers. 51 // Not to be confused with WebMessagePortChannelArray; this one uses Vector and
52 // std::unique_ptr instead of WebVector and raw pointers.
52 typedef Vector<WebMessagePortChannelUniquePtr, 1> MessagePortChannelArray; 53 typedef Vector<WebMessagePortChannelUniquePtr, 1> MessagePortChannelArray;
53 54
54 class CORE_EXPORT MessagePort : public EventTargetWithInlineData, 55 class CORE_EXPORT MessagePort : public EventTargetWithInlineData,
55 public ActiveScriptWrappable, 56 public ActiveScriptWrappable,
56 public ActiveDOMObject, 57 public ActiveDOMObject,
57 public WebMessagePortChannelClient { 58 public WebMessagePortChannelClient {
58 DEFINE_WRAPPERTYPEINFO(); 59 DEFINE_WRAPPERTYPEINFO();
59 USING_GARBAGE_COLLECTED_MIXIN(MessagePort); 60 USING_GARBAGE_COLLECTED_MIXIN(MessagePort);
60 61
61 public: 62 public:
(...skipping 13 matching lines...) Expand all
75 76
76 // Returns nullptr if the passed-in array is nullptr/empty. 77 // Returns nullptr if the passed-in array is nullptr/empty.
77 static std::unique_ptr<WebMessagePortChannelArray> 78 static std::unique_ptr<WebMessagePortChannelArray>
78 toWebMessagePortChannelArray(std::unique_ptr<MessagePortChannelArray>); 79 toWebMessagePortChannelArray(std::unique_ptr<MessagePortChannelArray>);
79 80
80 // Returns an empty array if the passed array is empty. 81 // Returns an empty array if the passed array is empty.
81 static MessagePortArray* toMessagePortArray( 82 static MessagePortArray* toMessagePortArray(
82 ExecutionContext*, 83 ExecutionContext*,
83 const WebMessagePortChannelArray&); 84 const WebMessagePortChannelArray&);
84 85
85 // Returns nullptr if there is an exception, or if the passed-in array is null ptr/empty. 86 // Returns nullptr if there is an exception, or if the passed-in array is
87 // nullptr/empty.
86 static std::unique_ptr<MessagePortChannelArray> 88 static std::unique_ptr<MessagePortChannelArray>
87 disentanglePorts(ExecutionContext*, const MessagePortArray&, ExceptionState&); 89 disentanglePorts(ExecutionContext*, const MessagePortArray&, ExceptionState&);
88 90
89 // Returns an empty array if the passed array is nullptr/empty. 91 // Returns an empty array if the passed array is nullptr/empty.
90 static MessagePortArray* entanglePorts( 92 static MessagePortArray* entanglePorts(
91 ExecutionContext&, 93 ExecutionContext&,
92 std::unique_ptr<MessagePortChannelArray>); 94 std::unique_ptr<MessagePortChannelArray>);
93 95
94 bool started() const { return m_started; } 96 bool started() const { return m_started; }
95 97
(...skipping 10 matching lines...) Expand all
106 void stop() override { close(); } 108 void stop() override { close(); }
107 109
108 void setOnmessage(EventListener* listener) { 110 void setOnmessage(EventListener* listener) {
109 setAttributeEventListener(EventTypeNames::message, listener); 111 setAttributeEventListener(EventTypeNames::message, listener);
110 start(); 112 start();
111 } 113 }
112 EventListener* onmessage() { 114 EventListener* onmessage() {
113 return getAttributeEventListener(EventTypeNames::message); 115 return getAttributeEventListener(EventTypeNames::message);
114 } 116 }
115 117
116 // A port starts out its life entangled, and remains entangled until it is clo sed or is cloned. 118 // A port starts out its life entangled, and remains entangled until it is
119 // closed or is cloned.
117 bool isEntangled() const { return !m_closed && !isNeutered(); } 120 bool isEntangled() const { return !m_closed && !isNeutered(); }
118 121
119 // A port gets neutered when it is transferred to a new owner via postMessage( ). 122 // A port gets neutered when it is transferred to a new owner via
123 // postMessage().
120 bool isNeutered() const { return !m_entangledChannel; } 124 bool isNeutered() const { return !m_entangledChannel; }
121 125
122 // For testing only: allows inspection of the entangled channel. 126 // For testing only: allows inspection of the entangled channel.
123 WebMessagePortChannel* entangledChannelForTesting() const { 127 WebMessagePortChannel* entangledChannelForTesting() const {
124 return m_entangledChannel.get(); 128 return m_entangledChannel.get();
125 } 129 }
126 130
127 DECLARE_VIRTUAL_TRACE(); 131 DECLARE_VIRTUAL_TRACE();
128 132
129 protected: 133 protected:
(...skipping 10 matching lines...) Expand all
140 144
141 bool m_started; 145 bool m_started;
142 bool m_closed; 146 bool m_closed;
143 147
144 RefPtr<ScriptState> m_scriptStateForConversion; 148 RefPtr<ScriptState> m_scriptStateForConversion;
145 }; 149 };
146 150
147 } // namespace blink 151 } // namespace blink
148 152
149 #endif // MessagePort_h 153 #endif // MessagePort_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp ('k') | third_party/WebKit/Source/core/dom/MessagePort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698