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

Side by Side Diff: Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp

Issue 10270006: Merge 113138 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 7 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) 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 26 matching lines...) Expand all
37 #include "ScriptExecutionContext.h" 37 #include "ScriptExecutionContext.h"
38 #include "WebSocketChannelClient.h" 38 #include "WebSocketChannelClient.h"
39 #include <wtf/PassRefPtr.h> 39 #include <wtf/PassRefPtr.h>
40 #include <wtf/RefPtr.h> 40 #include <wtf/RefPtr.h>
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper (ScriptExecutionContext* context, WebSocketChannelClient* client) 44 ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper (ScriptExecutionContext* context, WebSocketChannelClient* client)
45 : m_context(context) 45 : m_context(context)
46 , m_client(client) 46 , m_client(client)
47 , m_peer(0)
47 , m_syncMethodDone(true) 48 , m_syncMethodDone(true)
48 , m_useHixie76Protocol(true) 49 , m_useHixie76Protocol(true)
49 , m_sendRequestResult(ThreadableWebSocketChannel::SendFail) 50 , m_sendRequestResult(ThreadableWebSocketChannel::SendFail)
50 , m_bufferedAmount(0) 51 , m_bufferedAmount(0)
51 , m_suspended(false) 52 , m_suspended(false)
52 { 53 {
53 } 54 }
54 55
55 PassRefPtr<ThreadableWebSocketChannelClientWrapper> ThreadableWebSocketChannelCl ientWrapper::create(ScriptExecutionContext* context, WebSocketChannelClient* cli ent) 56 PassRefPtr<ThreadableWebSocketChannelClientWrapper> ThreadableWebSocketChannelCl ientWrapper::create(ScriptExecutionContext* context, WebSocketChannelClient* cli ent)
56 { 57 {
57 return adoptRef(new ThreadableWebSocketChannelClientWrapper(context, client) ); 58 return adoptRef(new ThreadableWebSocketChannelClientWrapper(context, client) );
58 } 59 }
59 60
60 void ThreadableWebSocketChannelClientWrapper::clearSyncMethodDone() 61 void ThreadableWebSocketChannelClientWrapper::clearSyncMethodDone()
61 { 62 {
62 m_syncMethodDone = false; 63 m_syncMethodDone = false;
63 } 64 }
64 65
65 void ThreadableWebSocketChannelClientWrapper::setSyncMethodDone() 66 void ThreadableWebSocketChannelClientWrapper::setSyncMethodDone()
66 { 67 {
67 m_syncMethodDone = true; 68 m_syncMethodDone = true;
68 } 69 }
69 70
70 bool ThreadableWebSocketChannelClientWrapper::syncMethodDone() const 71 bool ThreadableWebSocketChannelClientWrapper::syncMethodDone() const
71 { 72 {
72 return m_syncMethodDone; 73 return m_syncMethodDone;
73 } 74 }
74 75
76 WorkerThreadableWebSocketChannel::Peer* ThreadableWebSocketChannelClientWrapper: :peer() const
77 {
78 return m_peer;
79 }
80
81 void ThreadableWebSocketChannelClientWrapper::didCreateWebSocketChannel(WorkerTh readableWebSocketChannel::Peer* peer, bool useHixie76Protocol)
82 {
83 m_peer = peer;
84 m_useHixie76Protocol = useHixie76Protocol;
85 m_syncMethodDone = true;
86 }
87
88 void ThreadableWebSocketChannelClientWrapper::clearPeer()
89 {
90 m_peer = 0;
91 }
92
75 bool ThreadableWebSocketChannelClientWrapper::useHixie76Protocol() const 93 bool ThreadableWebSocketChannelClientWrapper::useHixie76Protocol() const
76 { 94 {
77 return m_useHixie76Protocol; 95 return m_useHixie76Protocol;
78 } 96 }
79 97
80 void ThreadableWebSocketChannelClientWrapper::setUseHixie76Protocol(bool useHixi e76Protocol)
81 {
82 m_useHixie76Protocol = useHixie76Protocol;
83 }
84
85 String ThreadableWebSocketChannelClientWrapper::subprotocol() const 98 String ThreadableWebSocketChannelClientWrapper::subprotocol() const
86 { 99 {
87 if (m_subprotocol.isEmpty()) 100 if (m_subprotocol.isEmpty())
88 return String(""); 101 return String("");
89 return String(m_subprotocol); 102 return String(m_subprotocol);
90 } 103 }
91 104
92 void ThreadableWebSocketChannelClientWrapper::setSubprotocol(const String& subpr otocol) 105 void ThreadableWebSocketChannelClientWrapper::setSubprotocol(const String& subpr otocol)
93 { 106 {
94 unsigned length = subprotocol.length(); 107 unsigned length = subprotocol.length();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void ThreadableWebSocketChannelClientWrapper::didCloseCallback(ScriptExecutionCo ntext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper, uns igned long unhandledBufferedAmount, WebSocketChannelClient::ClosingHandshakeComp letionStatus closingHandshakeCompletion, unsigned short code, const String& reas on) 265 void ThreadableWebSocketChannelClientWrapper::didCloseCallback(ScriptExecutionCo ntext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper, uns igned long unhandledBufferedAmount, WebSocketChannelClient::ClosingHandshakeComp letionStatus closingHandshakeCompletion, unsigned short code, const String& reas on)
253 { 266 {
254 ASSERT_UNUSED(context, !context); 267 ASSERT_UNUSED(context, !context);
255 if (wrapper->m_client) 268 if (wrapper->m_client)
256 wrapper->m_client->didClose(unhandledBufferedAmount, closingHandshakeCom pletion, code, reason); 269 wrapper->m_client->didClose(unhandledBufferedAmount, closingHandshakeCom pletion, code, reason);
257 } 270 }
258 271
259 } // namespace WebCore 272 } // namespace WebCore
260 273
261 #endif 274 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698