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 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 int64_t offset, | 87 int64_t offset, |
88 net::IOBuffer* buf, | 88 net::IOBuffer* buf, |
89 int buf_len, | 89 int buf_len, |
90 const net::CompletionCallback& callback) = 0; | 90 const net::CompletionCallback& callback) = 0; |
91 virtual int64_t GetSize(int index) = 0; | 91 virtual int64_t GetSize(int index) = 0; |
92 virtual void Close() = 0; | 92 virtual void Close() = 0; |
93 protected: | 93 protected: |
94 virtual ~Entry() {} | 94 virtual ~Entry() {} |
95 }; | 95 }; |
96 | 96 |
97 AppCacheDiskCacheInterface(); | 97 // The uma_name pointer must remain valid for the life of the object. |
| 98 AppCacheDiskCacheInterface(const char* uma_name); |
98 | 99 |
99 virtual int CreateEntry(int64_t key, | 100 virtual int CreateEntry(int64_t key, |
100 Entry** entry, | 101 Entry** entry, |
101 const net::CompletionCallback& callback) = 0; | 102 const net::CompletionCallback& callback) = 0; |
102 virtual int OpenEntry(int64_t key, | 103 virtual int OpenEntry(int64_t key, |
103 Entry** entry, | 104 Entry** entry, |
104 const net::CompletionCallback& callback) = 0; | 105 const net::CompletionCallback& callback) = 0; |
105 virtual int DoomEntry(int64_t key, | 106 virtual int DoomEntry(int64_t key, |
106 const net::CompletionCallback& callback) = 0; | 107 const net::CompletionCallback& callback) = 0; |
107 | 108 |
| 109 const char* uma_name() const { return uma_name_; } |
108 base::WeakPtr<AppCacheDiskCacheInterface> GetWeakPtr(); | 110 base::WeakPtr<AppCacheDiskCacheInterface> GetWeakPtr(); |
109 | 111 |
110 protected: | 112 protected: |
111 virtual ~AppCacheDiskCacheInterface(); | 113 virtual ~AppCacheDiskCacheInterface(); |
112 | 114 |
| 115 const char* uma_name_; |
113 base::WeakPtrFactory<AppCacheDiskCacheInterface> weak_factory_; | 116 base::WeakPtrFactory<AppCacheDiskCacheInterface> weak_factory_; |
114 }; | 117 }; |
115 | 118 |
116 // Common base class for response reader and writer. | 119 // Common base class for response reader and writer. |
117 class CONTENT_EXPORT AppCacheResponseIO { | 120 class CONTENT_EXPORT AppCacheResponseIO { |
118 public: | 121 public: |
119 virtual ~AppCacheResponseIO(); | 122 virtual ~AppCacheResponseIO(); |
120 int64_t response_id() const { return response_id_; } | 123 int64_t response_id() const { return response_id_; } |
121 | 124 |
122 protected: | 125 protected: |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void OnIOComplete(int result) override; | 322 void OnIOComplete(int result) override; |
320 void OnOpenEntryComplete() override; | 323 void OnOpenEntryComplete() override; |
321 | 324 |
322 int write_amount_; | 325 int write_amount_; |
323 base::WeakPtrFactory<AppCacheResponseMetadataWriter> weak_factory_; | 326 base::WeakPtrFactory<AppCacheResponseMetadataWriter> weak_factory_; |
324 }; | 327 }; |
325 | 328 |
326 } // namespace content | 329 } // namespace content |
327 | 330 |
328 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ | 331 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ |
OLD | NEW |