OLD | NEW |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 class Bridge; | 90 class Bridge; |
91 // Allocated and used in the main thread. | 91 // Allocated and used in the main thread. |
92 class Peer final : public GarbageCollectedFinalized<Peer>, | 92 class Peer final : public GarbageCollectedFinalized<Peer>, |
93 public WebSocketChannelClient, | 93 public WebSocketChannelClient, |
94 public WorkerThreadLifecycleObserver { | 94 public WorkerThreadLifecycleObserver { |
95 USING_GARBAGE_COLLECTED_MIXIN(Peer); | 95 USING_GARBAGE_COLLECTED_MIXIN(Peer); |
96 WTF_MAKE_NONCOPYABLE(Peer); | 96 WTF_MAKE_NONCOPYABLE(Peer); |
97 | 97 |
98 public: | 98 public: |
99 Peer(Bridge*, | 99 Peer(Bridge*, RefPtr<WebTaskRunner>, WorkerThreadLifecycleContext*); |
100 RefPtr<WebTaskRunner>, | |
101 WorkerThreadLifecycleContext*); | |
102 ~Peer() override; | 100 ~Peer() override; |
103 | 101 |
104 // SourceLocation parameter may be shown when the connection fails. | 102 // SourceLocation parameter may be shown when the connection fails. |
105 bool Initialize(std::unique_ptr<SourceLocation>, ThreadableLoadingContext*); | 103 bool Initialize(std::unique_ptr<SourceLocation>, ThreadableLoadingContext*); |
106 | 104 |
107 bool Connect(const KURL&, const String& protocol); | 105 bool Connect(const KURL&, const String& protocol); |
108 void SendTextAsCharVector(std::unique_ptr<Vector<char>>); | 106 void SendTextAsCharVector(std::unique_ptr<Vector<char>>); |
109 void SendBinaryAsCharVector(std::unique_ptr<Vector<char>>); | 107 void SendBinaryAsCharVector(std::unique_ptr<Vector<char>>); |
110 void SendBlob(PassRefPtr<BlobDataHandle>); | 108 void SendBlob(PassRefPtr<BlobDataHandle>); |
111 void Close(int code, const String& reason); | 109 void Close(int code, const String& reason); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 WebSocketChannelClient*, | 188 WebSocketChannelClient*, |
191 std::unique_ptr<SourceLocation>); | 189 std::unique_ptr<SourceLocation>); |
192 | 190 |
193 Member<Bridge> bridge_; | 191 Member<Bridge> bridge_; |
194 std::unique_ptr<SourceLocation> location_at_connection_; | 192 std::unique_ptr<SourceLocation> location_at_connection_; |
195 }; | 193 }; |
196 | 194 |
197 } // namespace blink | 195 } // namespace blink |
198 | 196 |
199 #endif // WorkerWebSocketChannel_h | 197 #endif // WorkerWebSocketChannel_h |
OLD | NEW |