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

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

Issue 311993006: [WebSocket] bufferedAmount should not decrease inside a task. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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(); }
60 59
61 SocketStreamHandleClient* client() const { return m_client; } 60 SocketStreamHandleClient* client() const { return m_client; }
62 void setClient(SocketStreamHandleClient*); 61 void setClient(SocketStreamHandleClient*);
63 62
64 private: 63 private:
65 SocketStreamHandle(SocketStreamHandleClient*); 64 SocketStreamHandle(SocketStreamHandleClient*);
66 65
67 bool sendPendingData(); 66 bool sendPendingData();
68 67
69 int sendInternal(const char* data, int length); 68 int sendInternal(const char* data, int length);
70 void closeInternal(); 69 void closeInternal();
71 70
72 SocketStreamHandleClient* m_client; 71 SocketStreamHandleClient* m_client;
73 StreamBuffer<char, 1024 * 1024> m_buffer; 72 StreamBuffer<char, 1024 * 1024> m_buffer;
74 SocketStreamState m_state; 73 SocketStreamState m_state;
75 74
76 friend class SocketStreamHandleInternal; 75 friend class SocketStreamHandleInternal;
77 OwnPtr<SocketStreamHandleInternal> m_internal; 76 OwnPtr<SocketStreamHandleInternal> m_internal;
78 }; 77 };
79 78
80 } // namespace WebCore 79 } // namespace WebCore
81 80
82 #endif // SocketStreamHandle_h 81 #endif // SocketStreamHandle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698