Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Side by Side Diff: net/base/sdch_dictionary_fetcher.h

Issue 704493002: Revert "Sdch view for net-internals" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/net_log_util.cc ('k') | net/base/sdch_dictionary_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // TODO(rdsmith): This class needs to be moved out to the net/ embedder and 5 // TODO(rdsmith): This class needs to be moved out to the net/ embedder and
6 // hooked into whatever mechanisms the embedder uses for authentication. 6 // hooked into whatever mechanisms the embedder uses for authentication.
7 // Specifically, this class needs methods overriding 7 // Specifically, this class needs methods overriding
8 // URLRequest::Delegate::{OnAuthRequired,OnCertificateRequested} and can't 8 // URLRequest::Delegate::{OnAuthRequired,OnCertificateRequested} and can't
9 // implement them at the net/ layer. 9 // implement them at the net/ layer.
10 10
(...skipping 26 matching lines...) Expand all
37 public URLRequest::Delegate, 37 public URLRequest::Delegate,
38 public base::NonThreadSafe { 38 public base::NonThreadSafe {
39 public: 39 public:
40 // The consumer must guarantee that |*consumer| and |*context| outlive 40 // The consumer must guarantee that |*consumer| and |*context| outlive
41 // this object. 41 // this object.
42 SdchDictionaryFetcher(SdchFetcher::Delegate* consumer, 42 SdchDictionaryFetcher(SdchFetcher::Delegate* consumer,
43 URLRequestContext* context); 43 URLRequestContext* context);
44 ~SdchDictionaryFetcher() override; 44 ~SdchDictionaryFetcher() override;
45 45
46 // Implementation of SdchFetcher methods. 46 // Implementation of SdchFetcher methods.
47 bool Schedule(const GURL& dictionary_url) override; 47 void Schedule(const GURL& dictionary_url) override;
48 void Cancel() override; 48 void Cancel() override;
49 49
50 // Implementation of URLRequest::Delegate methods. 50 // Implementation of URLRequest::Delegate methods.
51 void OnResponseStarted(URLRequest* request) override; 51 void OnResponseStarted(URLRequest* request) override;
52 void OnReadCompleted(URLRequest* request, int bytes_read) override; 52 void OnReadCompleted(URLRequest* request, int bytes_read) override;
53 53
54 private: 54 private:
55 enum State { 55 enum State {
56 STATE_NONE, 56 STATE_NONE,
57 STATE_IDLE, 57 STATE_IDLE,
58 STATE_REQUEST_STARTED, 58 STATE_REQUEST_STARTED,
59 STATE_REQUEST_READING, 59 STATE_REQUEST_READING,
60 STATE_REQUEST_COMPLETE, 60 STATE_REQUEST_COMPLETE,
61 }; 61 };
62 62
63 // State machine implementation. 63 // State machine implementation.
64 int DoLoop(int rv); 64 int DoLoop(int rv);
65 int DoDispatchRequest(int rv); 65 int DoDispatchRequest(int rv);
66 int DoRequestStarted(int rv); 66 int DoRequestStarted(int rv);
67 int DoRead(int rv); 67 int DoRead(int rv);
68 int DoCompleteRequest(int rv); 68 int DoCompleteRequest(int rv);
69 69
70 // Record SDCH problem histogram and add netlog event.
71 void LogDictionaryFetchError(SdchProblemCode error);
72
73 State next_state_; 70 State next_state_;
74 bool in_loop_; 71 bool in_loop_;
75 72
76 SdchFetcher::Delegate* const consumer_; 73 SdchFetcher::Delegate* const consumer_;
77 74
78 // A queue of URLs that are being used to download dictionaries. 75 // A queue of URLs that are being used to download dictionaries.
79 std::queue<GURL> fetch_queue_; 76 std::queue<GURL> fetch_queue_;
80 77
81 // The request and buffer used for getting the current dictionary 78 // The request and buffer used for getting the current dictionary
82 // Both are null when a fetch is not in progress. 79 // Both are null when a fetch is not in progress.
(...skipping 23 matching lines...) Expand all
106 URLRequestContext* context_; 103 URLRequestContext* context_;
107 104
108 base::WeakPtrFactory<SdchDictionaryFetcher> weak_factory_; 105 base::WeakPtrFactory<SdchDictionaryFetcher> weak_factory_;
109 106
110 DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher); 107 DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher);
111 }; 108 };
112 109
113 } // namespace net 110 } // namespace net
114 111
115 #endif // NET_BASE_SDCH_DICTIONARY_FETCHER_H_ 112 #endif // NET_BASE_SDCH_DICTIONARY_FETCHER_H_
OLDNEW
« no previous file with comments | « net/base/net_log_util.cc ('k') | net/base/sdch_dictionary_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698