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

Side by Side Diff: trunk/Source/platform/network/SocketStreamHandle.h

Issue 338243006: Revert 176298 "[WebSocket] bufferedAmount should not decrease in..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 static PassRefPtr<SocketStreamHandle> create(SocketStreamHandleClient* clien t) { return adoptRef(new SocketStreamHandle(client)); } 50 static PassRefPtr<SocketStreamHandle> create(SocketStreamHandleClient* clien t) { return adoptRef(new SocketStreamHandle(client)); }
51 51
52 virtual ~SocketStreamHandle(); 52 virtual ~SocketStreamHandle();
53 SocketStreamState state() const; 53 SocketStreamState state() const;
54 54
55 void connect(const KURL&); 55 void connect(const KURL&);
56 bool send(const char* data, int length); 56 bool send(const char* data, int length);
57 void close(); // Disconnect after all data in buffer are sent. 57 void close(); // Disconnect after all data in buffer are sent.
58 void disconnect(); 58 void disconnect();
59 size_t bufferedAmount() const { return m_buffer.size(); }
59 60
60 SocketStreamHandleClient* client() const { return m_client; } 61 SocketStreamHandleClient* client() const { return m_client; }
61 void setClient(SocketStreamHandleClient*); 62 void setClient(SocketStreamHandleClient*);
62 63
63 private: 64 private:
64 SocketStreamHandle(SocketStreamHandleClient*); 65 SocketStreamHandle(SocketStreamHandleClient*);
65 66
66 bool sendPendingData(); 67 bool sendPendingData();
67 68
68 int sendInternal(const char* data, int length); 69 int sendInternal(const char* data, int length);
69 void closeInternal(); 70 void closeInternal();
70 71
71 SocketStreamHandleClient* m_client; 72 SocketStreamHandleClient* m_client;
72 StreamBuffer<char, 1024 * 1024> m_buffer; 73 StreamBuffer<char, 1024 * 1024> m_buffer;
73 SocketStreamState m_state; 74 SocketStreamState m_state;
74 75
75 friend class SocketStreamHandleInternal; 76 friend class SocketStreamHandleInternal;
76 OwnPtr<SocketStreamHandleInternal> m_internal; 77 OwnPtr<SocketStreamHandleInternal> m_internal;
77 }; 78 };
78 79
79 } // namespace WebCore 80 } // namespace WebCore
80 81
81 #endif // SocketStreamHandle_h 82 #endif // SocketStreamHandle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698