OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_TOOLS_FLIP_SERVER_MEM_CACHE_H_ | 5 #ifndef NET_TOOLS_FLIP_SERVER_MEM_CACHE_H_ |
6 #define NET_TOOLS_FLIP_SERVER_MEM_CACHE_H_ | 6 #define NET_TOOLS_FLIP_SERVER_MEM_CACHE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 #include <string> | 13 #include <string> |
13 | 14 |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "net/tools/balsa/balsa_headers.h" | 17 #include "net/tools/balsa/balsa_headers.h" |
18 #include "net/tools/balsa/balsa_visitor_interface.h" | 18 #include "net/tools/balsa/balsa_visitor_interface.h" |
19 #include "net/tools/flip_server/constants.h" | 19 #include "net/tools/flip_server/constants.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class StoreBodyAndHeadersVisitor : public BalsaVisitorInterface { | 23 class StoreBodyAndHeadersVisitor : public BalsaVisitorInterface { |
24 public: | 24 public: |
25 void HandleError() { error_ = true; } | 25 void HandleError() { error_ = true; } |
26 | 26 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const std::string& body); | 71 const std::string& body); |
72 ~FileData(); | 72 ~FileData(); |
73 | 73 |
74 BalsaHeaders* headers() { return headers_.get(); } | 74 BalsaHeaders* headers() { return headers_.get(); } |
75 const BalsaHeaders* headers() const { return headers_.get(); } | 75 const BalsaHeaders* headers() const { return headers_.get(); } |
76 | 76 |
77 const std::string& filename() { return filename_; } | 77 const std::string& filename() { return filename_; } |
78 const std::string& body() { return body_; } | 78 const std::string& body() { return body_; } |
79 | 79 |
80 private: | 80 private: |
81 scoped_ptr<BalsaHeaders> headers_; | 81 std::unique_ptr<BalsaHeaders> headers_; |
82 std::string filename_; | 82 std::string filename_; |
83 std::string body_; | 83 std::string body_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(FileData); | 85 DISALLOW_COPY_AND_ASSIGN(FileData); |
86 }; | 86 }; |
87 | 87 |
88 class MemCacheIter { | 88 class MemCacheIter { |
89 public: | 89 public: |
90 MemCacheIter() | 90 MemCacheIter() |
91 : file_data(NULL), | 91 : file_data(NULL), |
(...skipping 15 matching lines...) Expand all Loading... |
107 int priority; | 107 int priority; |
108 bool transformed_header; | 108 bool transformed_header; |
109 size_t body_bytes_consumed; | 109 size_t body_bytes_consumed; |
110 uint32_t stream_id; | 110 uint32_t stream_id; |
111 uint32_t max_segment_size; | 111 uint32_t max_segment_size; |
112 size_t bytes_sent; | 112 size_t bytes_sent; |
113 }; | 113 }; |
114 | 114 |
115 class MemoryCache { | 115 class MemoryCache { |
116 public: | 116 public: |
117 using Files = std::map<std::string, scoped_ptr<FileData>>; | 117 using Files = std::map<std::string, std::unique_ptr<FileData>>; |
118 | 118 |
119 public: | 119 public: |
120 MemoryCache(); | 120 MemoryCache(); |
121 virtual ~MemoryCache(); | 121 virtual ~MemoryCache(); |
122 | 122 |
123 void AddFiles(); | 123 void AddFiles(); |
124 | 124 |
125 // virtual for unittests | 125 // virtual for unittests |
126 virtual void ReadToString(const char* filename, std::string* output); | 126 virtual void ReadToString(const char* filename, std::string* output); |
127 | 127 |
(...skipping 17 matching lines...) Expand all Loading... |
145 | 145 |
146 class NotifierInterface { | 146 class NotifierInterface { |
147 public: | 147 public: |
148 virtual ~NotifierInterface() {} | 148 virtual ~NotifierInterface() {} |
149 virtual void Notify() = 0; | 149 virtual void Notify() = 0; |
150 }; | 150 }; |
151 | 151 |
152 } // namespace net | 152 } // namespace net |
153 | 153 |
154 #endif // NET_TOOLS_FLIP_SERVER_MEM_CACHE_H_ | 154 #endif // NET_TOOLS_FLIP_SERVER_MEM_CACHE_H_ |
OLD | NEW |