| 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_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ | 5 #ifndef NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ |
| 6 #define NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ | 6 #define NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 enum State { | 41 enum State { |
| 42 GET_BACKEND, | 42 GET_BACKEND, |
| 43 GET_BACKEND_COMPLETE, | 43 GET_BACKEND_COMPLETE, |
| 44 OPEN, | 44 OPEN, |
| 45 OPEN_COMPLETE, | 45 OPEN_COMPLETE, |
| 46 READ, | 46 READ, |
| 47 READ_COMPLETE, | 47 READ_COMPLETE, |
| 48 WAIT_FOR_DATA_READY_DONE, | 48 WAIT_FOR_DATA_READY_DONE, |
| 49 CREATE, | 49 CREATE_OR_OPEN, |
| 50 CREATE_COMPLETE, | 50 CREATE_OR_OPEN_COMPLETE, |
| 51 WRITE, | 51 WRITE, |
| 52 WRITE_COMPLETE, | 52 WRITE_COMPLETE, |
| 53 SET_DONE, | 53 SET_DONE, |
| 54 NONE, | 54 NONE, |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class CallbackImpl : public CallbackRunner<Tuple1<int> > { | 57 class CallbackImpl : public CallbackRunner<Tuple1<int> > { |
| 58 public: | 58 public: |
| 59 CallbackImpl(const base::WeakPtr<DiskCacheBasedSSLHostInfo>& obj, | 59 CallbackImpl(const base::WeakPtr<DiskCacheBasedSSLHostInfo>& obj, |
| 60 void (DiskCacheBasedSSLHostInfo::*meth)(int)); | 60 void (DiskCacheBasedSSLHostInfo::*meth)(int)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 81 std::string key() const; | 81 std::string key() const; |
| 82 | 82 |
| 83 void OnIOComplete(int rv); | 83 void OnIOComplete(int rv); |
| 84 | 84 |
| 85 int DoLoop(int rv); | 85 int DoLoop(int rv); |
| 86 | 86 |
| 87 int DoGetBackendComplete(int rv); | 87 int DoGetBackendComplete(int rv); |
| 88 int DoOpenComplete(int rv); | 88 int DoOpenComplete(int rv); |
| 89 int DoReadComplete(int rv); | 89 int DoReadComplete(int rv); |
| 90 int DoWriteComplete(int rv); | 90 int DoWriteComplete(int rv); |
| 91 int DoCreateComplete(int rv); | 91 int DoCreateOrOpenComplete(int rv); |
| 92 | 92 |
| 93 int DoGetBackend(); | 93 int DoGetBackend(); |
| 94 int DoOpen(); | 94 int DoOpen(); |
| 95 int DoRead(); | 95 int DoRead(); |
| 96 int DoWrite(); | 96 int DoWrite(); |
| 97 int DoCreate(); | 97 int DoCreateOrOpen(); |
| 98 | 98 |
| 99 // DoWaitForDataReadyDone is the terminal state of the read operation. | 99 // DoWaitForDataReadyDone is the terminal state of the read operation. |
| 100 int DoWaitForDataReadyDone(); | 100 int DoWaitForDataReadyDone(); |
| 101 | 101 |
| 102 // DoSetDone is the terminal state of the write operation. | 102 // DoSetDone is the terminal state of the write operation. |
| 103 int DoSetDone(); | 103 int DoSetDone(); |
| 104 | 104 |
| 105 // IsCallbackPending returns true if we have a pending callback. | 105 // IsCallbackPending returns true if we have a pending callback. |
| 106 bool IsCallbackPending() const; | 106 bool IsCallbackPending() const; |
| 107 | 107 |
| 108 base::WeakPtrFactory<DiskCacheBasedSSLHostInfo> weak_ptr_factory_; | 108 base::WeakPtrFactory<DiskCacheBasedSSLHostInfo> weak_ptr_factory_; |
| 109 CallbackImpl* callback_; | 109 CallbackImpl* callback_; |
| 110 State state_; | 110 State state_; |
| 111 bool ready_; | 111 bool ready_; |
| 112 bool found_entry_; // Controls the behavior of DoCreateOrOpen. |
| 112 std::string new_data_; | 113 std::string new_data_; |
| 113 const std::string hostname_; | 114 const std::string hostname_; |
| 114 HttpCache* const http_cache_; | 115 HttpCache* const http_cache_; |
| 115 disk_cache::Backend* backend_; | 116 disk_cache::Backend* backend_; |
| 116 disk_cache::Entry* entry_; | 117 disk_cache::Entry* entry_; |
| 117 OldCompletionCallback* user_callback_; | 118 OldCompletionCallback* user_callback_; |
| 118 scoped_refptr<IOBuffer> read_buffer_; | 119 scoped_refptr<IOBuffer> read_buffer_; |
| 119 scoped_refptr<IOBuffer> write_buffer_; | 120 scoped_refptr<IOBuffer> write_buffer_; |
| 120 std::string data_; | 121 std::string data_; |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 } // namespace net | 124 } // namespace net |
| 124 | 125 |
| 125 #endif // NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ | 126 #endif // NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ |
| OLD | NEW |