| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/web_socket_proxy.h" | 5 #include "chrome/browser/chromeos/web_socket_proxy.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 }; | 457 }; |
| 458 | 458 |
| 459 class DerivedIOBufferWithSize : public net::IOBufferWithSize { | 459 class DerivedIOBufferWithSize : public net::IOBufferWithSize { |
| 460 public: | 460 public: |
| 461 DerivedIOBufferWithSize(net::IOBuffer* host, int size) | 461 DerivedIOBufferWithSize(net::IOBuffer* host, int size) |
| 462 : IOBufferWithSize(host->data(), size), host_(host) { | 462 : IOBufferWithSize(host->data(), size), host_(host) { |
| 463 DCHECK(host_); | 463 DCHECK(host_); |
| 464 DCHECK(host_->data()); | 464 DCHECK(host_->data()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 protected: |
| 467 virtual ~DerivedIOBufferWithSize() { | 468 virtual ~DerivedIOBufferWithSize() { |
| 468 data_ = NULL; // We do not own memory, bypass base class destructor. | 469 data_ = NULL; // We do not own memory, bypass base class destructor. |
| 469 } | 470 } |
| 470 | 471 |
| 471 protected: | |
| 472 scoped_refptr<net::IOBuffer> host_; | 472 scoped_refptr<net::IOBuffer> host_; |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 // Provides queue of data represented as IOBuffers. | 475 // Provides queue of data represented as IOBuffers. |
| 476 class IOBufferQueue { | 476 class IOBufferQueue { |
| 477 public: | 477 public: |
| 478 // We do not allocate all capacity at once but lazily in |buf_size_| chunks. | 478 // We do not allocate all capacity at once but lazily in |buf_size_| chunks. |
| 479 explicit IOBufferQueue(int capacity) | 479 explicit IOBufferQueue(int capacity) |
| 480 : buf_size_(1 + capacity / kNumBuffersLimit) { | 480 : buf_size_(1 + capacity / kNumBuffersLimit) { |
| 481 } | 481 } |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 | 1901 |
| 1902 void WebSocketProxy::Shutdown() { | 1902 void WebSocketProxy::Shutdown() { |
| 1903 static_cast<Serv*>(impl_)->Shutdown(); | 1903 static_cast<Serv*>(impl_)->Shutdown(); |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 void WebSocketProxy::OnNetworkChange() { | 1906 void WebSocketProxy::OnNetworkChange() { |
| 1907 static_cast<Serv*>(impl_)->OnNetworkChange(); | 1907 static_cast<Serv*>(impl_)->OnNetworkChange(); |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 } // namespace chromeos | 1910 } // namespace chromeos |
| OLD | NEW |