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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.h

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef PresentationConnection_h 5 #ifndef PresentationConnection_h
6 #define PresentationConnection_h 6 #define PresentationConnection_h
7 7
8 #include "core/events/EventTarget.h" 8 #include "core/events/EventTarget.h"
9 #include "core/fileapi/Blob.h" 9 #include "core/fileapi/Blob.h"
10 #include "core/fileapi/FileError.h" 10 #include "core/fileapi/FileError.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // EventTarget implementation. 42 // EventTarget implementation.
43 const AtomicString& interfaceName() const override; 43 const AtomicString& interfaceName() const override;
44 ExecutionContext* getExecutionContext() const override; 44 ExecutionContext* getExecutionContext() const override;
45 45
46 DECLARE_VIRTUAL_TRACE(); 46 DECLARE_VIRTUAL_TRACE();
47 47
48 const String& id() const { return m_id; } 48 const String& id() const { return m_id; }
49 const WTF::AtomicString& state() const; 49 const WTF::AtomicString& state() const;
50 50
51 void send(const String& message, ExceptionState&); 51 void send(const String& message, ExceptionState&);
52 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); 52 void send(DOMArrayBuffer*, ExceptionState&);
53 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); 53 void send(DOMArrayBufferView*, ExceptionState&);
54 void send(Blob*, ExceptionState&); 54 void send(Blob*, ExceptionState&);
55 void close(); 55 void close();
56 void terminate(); 56 void terminate();
57 57
58 String binaryType() const; 58 String binaryType() const;
59 void setBinaryType(const String&); 59 void setBinaryType(const String&);
60 60
61 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
62 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
63 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect);
(...skipping 24 matching lines...) Expand all
88 MessageTypeText, 88 MessageTypeText,
89 MessageTypeArrayBuffer, 89 MessageTypeArrayBuffer,
90 MessageTypeBlob, 90 MessageTypeBlob,
91 }; 91 };
92 92
93 enum BinaryType { 93 enum BinaryType {
94 BinaryTypeBlob, 94 BinaryTypeBlob,
95 BinaryTypeArrayBuffer 95 BinaryTypeArrayBuffer
96 }; 96 };
97 97
98 struct Message { 98 class Message;
99 Message(const String& text)
100 : type(MessageTypeText)
101 , text(text) { }
102
103 Message(PassRefPtr<DOMArrayBuffer> arrayBuffer)
104 : type(MessageTypeArrayBuffer)
105 , arrayBuffer(arrayBuffer) { }
106
107 Message(PassRefPtr<BlobDataHandle> blobDataHandle)
108 : type(MessageTypeBlob)
109 , blobDataHandle(blobDataHandle) { }
110
111 MessageType type;
112 String text;
113 RefPtr<DOMArrayBuffer> arrayBuffer;
114 RefPtr<BlobDataHandle> blobDataHandle;
115 };
116 99
117 PresentationConnection(LocalFrame*, const String& id, const String& url); 100 PresentationConnection(LocalFrame*, const String& id, const String& url);
118 101
119 bool canSendMessage(ExceptionState&); 102 bool canSendMessage(ExceptionState&);
120 void handleMessageQueue(); 103 void handleMessageQueue();
121 104
122 // Callbacks invoked from BlobLoader. 105 // Callbacks invoked from BlobLoader.
123 void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>); 106 void didFinishLoadingBlob(DOMArrayBuffer*);
124 void didFailLoadingBlob(FileError::ErrorCode); 107 void didFailLoadingBlob(FileError::ErrorCode);
125 108
126 // Cancel loads and pending messages when the connection is closed. 109 // Cancel loads and pending messages when the connection is closed.
127 void tearDown(); 110 void tearDown();
128 111
129 String m_id; 112 String m_id;
130 String m_url; 113 String m_url;
131 WebPresentationConnectionState m_state; 114 WebPresentationConnectionState m_state;
132 115
133 // For Blob data handling. 116 // For Blob data handling.
134 Member<BlobLoader> m_blobLoader; 117 Member<BlobLoader> m_blobLoader;
135 Deque<OwnPtr<Message>> m_messages; 118 HeapDeque<Member<Message>> m_messages;
136 119
137 BinaryType m_binaryType; 120 BinaryType m_binaryType;
138 }; 121 };
139 122
140 } // namespace blink 123 } // namespace blink
141 124
142 #endif // PresentationConnection_h 125 #endif // PresentationConnection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698