| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // DnsQueue is implemented as an almost FIFO circular buffer for text | 5 // DnsQueue is implemented as an almost FIFO circular buffer for text |
| 6 // strings that don't have embedded nulls ('\0'). The "almost" element is that | 6 // strings that don't have embedded nulls ('\0'). The "almost" element is that |
| 7 // some duplicate strings may be removed (i.e., the string won't really be | 7 // some duplicate strings may be removed (i.e., the string won't really be |
| 8 // pushed *if* the class happens to notice that a duplicate is already in the | 8 // pushed *if* the class happens to notice that a duplicate is already in the |
| 9 // queue). | 9 // queue). |
| 10 // The buffers internal format is null terminated character strings | 10 // The buffers internal format is null terminated character strings |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // rendering, the supplier is the renderer (typically), and the consumer | 21 // rendering, the supplier is the renderer (typically), and the consumer |
| 22 // is a thread that sends messages to an async DNS resolver. | 22 // is a thread that sends messages to an async DNS resolver. |
| 23 | 23 |
| 24 #ifndef CHROME_RENDERER_NET_PREDICTOR_QUEUE_H__ | 24 #ifndef CHROME_RENDERER_NET_PREDICTOR_QUEUE_H__ |
| 25 #define CHROME_RENDERER_NET_PREDICTOR_QUEUE_H__ | 25 #define CHROME_RENDERER_NET_PREDICTOR_QUEUE_H__ |
| 26 #pragma once | 26 #pragma once |
| 27 | 27 |
| 28 #include <string> | 28 #include <string> |
| 29 | 29 |
| 30 #include "base/basictypes.h" | 30 #include "base/basictypes.h" |
| 31 #include "base/lock.h" | |
| 32 #include "base/scoped_ptr.h" | 31 #include "base/scoped_ptr.h" |
| 33 | 32 |
| 34 class DnsQueue { | 33 class DnsQueue { |
| 35 public: | 34 public: |
| 36 // BufferSize is a signed type used for indexing into a buffer. | 35 // BufferSize is a signed type used for indexing into a buffer. |
| 37 typedef int32 BufferSize; | 36 typedef int32 BufferSize; |
| 38 | 37 |
| 39 enum PushResult { SUCCESSFUL_PUSH, OVERFLOW_PUSH, REDUNDANT_PUSH }; | 38 enum PushResult { SUCCESSFUL_PUSH, OVERFLOW_PUSH, REDUNDANT_PUSH }; |
| 40 | 39 |
| 41 // The size specified in the constructor creates a buffer large enough | 40 // The size specified in the constructor creates a buffer large enough |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 BufferSize readable_; // Next readable char in buffer_. | 83 BufferSize readable_; // Next readable char in buffer_. |
| 85 BufferSize writeable_; // The next space in buffer_ to push. | 84 BufferSize writeable_; // The next space in buffer_ to push. |
| 86 | 85 |
| 87 // Number of queued strings | 86 // Number of queued strings |
| 88 size_t size_; | 87 size_t size_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(DnsQueue); | 89 DISALLOW_COPY_AND_ASSIGN(DnsQueue); |
| 91 }; // class DnsQueue | 90 }; // class DnsQueue |
| 92 | 91 |
| 93 #endif // CHROME_RENDERER_NET_PREDICTOR_QUEUE_H__ | 92 #endif // CHROME_RENDERER_NET_PREDICTOR_QUEUE_H__ |
| OLD | NEW |