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

Side by Side Diff: Source/modules/websockets/DOMWebSocket.h

Issue 606653006: bindings: Adds DOMArrayBuffer, etc. as thin wrappers for ArrayBuffer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webmidi/MIDIOutput.cpp ('k') | Source/modules/websockets/DOMWebSocket.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 #include "platform/Timer.h" 39 #include "platform/Timer.h"
40 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
41 #include "platform/weborigin/KURL.h" 41 #include "platform/weborigin/KURL.h"
42 #include "wtf/Deque.h" 42 #include "wtf/Deque.h"
43 #include "wtf/Forward.h" 43 #include "wtf/Forward.h"
44 #include "wtf/text/AtomicStringHash.h" 44 #include "wtf/text/AtomicStringHash.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class Blob; 48 class Blob;
49 class DOMArrayBuffer;
50 class DOMArrayBufferView;
49 class ExceptionState; 51 class ExceptionState;
50 52
51 class DOMWebSocket : public RefCountedGarbageCollectedWillBeGarbageCollectedFina lized<DOMWebSocket>, public EventTargetWithInlineData, public ActiveDOMObject, p ublic WebSocketChannelClient { 53 class DOMWebSocket : public RefCountedGarbageCollectedWillBeGarbageCollectedFina lized<DOMWebSocket>, public EventTargetWithInlineData, public ActiveDOMObject, p ublic WebSocketChannelClient {
52 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<D OMWebSocket>); 54 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<D OMWebSocket>);
53 DEFINE_WRAPPERTYPEINFO(); 55 DEFINE_WRAPPERTYPEINFO();
54 USING_GARBAGE_COLLECTED_MIXIN(DOMWebSocket); 56 USING_GARBAGE_COLLECTED_MIXIN(DOMWebSocket);
55 public: 57 public:
56 static const char* subprotocolSeperator(); 58 static const char* subprotocolSeperator();
57 // DOMWebSocket instances must be used with a wrapper since this class's 59 // DOMWebSocket instances must be used with a wrapper since this class's
58 // lifetime management is designed assuming the V8 holds a ref on it while 60 // lifetime management is designed assuming the V8 holds a ref on it while
59 // hasPendingActivity() returns true. 61 // hasPendingActivity() returns true.
60 static DOMWebSocket* create(ExecutionContext*, const String& url, ExceptionS tate&); 62 static DOMWebSocket* create(ExecutionContext*, const String& url, ExceptionS tate&);
61 static DOMWebSocket* create(ExecutionContext*, const String& url, const Stri ng& protocol, ExceptionState&); 63 static DOMWebSocket* create(ExecutionContext*, const String& url, const Stri ng& protocol, ExceptionState&);
62 static DOMWebSocket* create(ExecutionContext*, const String& url, const Vect or<String>& protocols, ExceptionState&); 64 static DOMWebSocket* create(ExecutionContext*, const String& url, const Vect or<String>& protocols, ExceptionState&);
63 virtual ~DOMWebSocket(); 65 virtual ~DOMWebSocket();
64 66
65 enum State { 67 enum State {
66 CONNECTING = 0, 68 CONNECTING = 0,
67 OPEN = 1, 69 OPEN = 1,
68 CLOSING = 2, 70 CLOSING = 2,
69 CLOSED = 3 71 CLOSED = 3
70 }; 72 };
71 73
72 void connect(const String& url, const Vector<String>& protocols, ExceptionSt ate&); 74 void connect(const String& url, const Vector<String>& protocols, ExceptionSt ate&);
73 75
74 void send(const String& message, ExceptionState&); 76 void send(const String& message, ExceptionState&);
75 void send(ArrayBuffer*, ExceptionState&); 77 void send(DOMArrayBuffer*, ExceptionState&);
76 void send(ArrayBufferView*, ExceptionState&); 78 void send(DOMArrayBufferView*, ExceptionState&);
77 void send(Blob*, ExceptionState&); 79 void send(Blob*, ExceptionState&);
78 80
79 // To distinguish close method call with the code parameter from one 81 // To distinguish close method call with the code parameter from one
80 // without, we have these three signatures. Use of 82 // without, we have these three signatures. Use of
81 // Optional=DefaultIsUndefined in the IDL file doesn't help for now since 83 // Optional=DefaultIsUndefined in the IDL file doesn't help for now since
82 // it's bound to a value of 0 which is indistinguishable from the case 0 84 // it's bound to a value of 0 which is indistinguishable from the case 0
83 // is passed as code parameter. 85 // is passed as code parameter.
84 void close(unsigned short code, const String& reason, ExceptionState&); 86 void close(unsigned short code, const String& reason, ExceptionState&);
85 void close(ExceptionState&); 87 void close(ExceptionState&);
86 void close(unsigned short code, ExceptionState&); 88 void close(unsigned short code, ExceptionState&);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 String m_subprotocol; 225 String m_subprotocol;
224 String m_extensions; 226 String m_extensions;
225 227
226 Member<EventQueue> m_eventQueue; 228 Member<EventQueue> m_eventQueue;
227 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; 229 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer;
228 }; 230 };
229 231
230 } // namespace blink 232 } // namespace blink
231 233
232 #endif // DOMWebSocket_h 234 #endif // DOMWebSocket_h
OLDNEW
« no previous file with comments | « Source/modules/webmidi/MIDIOutput.cpp ('k') | Source/modules/websockets/DOMWebSocket.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698