| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ | |
| 6 #define CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "content/public/browser/browser_message_filter.h" | |
| 10 | |
| 11 namespace net { | |
| 12 class URLRequestContextGetter; | |
| 13 } | |
| 14 | |
| 15 class Profile; | |
| 16 | |
| 17 // This class filters out incoming Chrome-specific benchmarking IPC messages | |
| 18 // for the renderer process on the IPC thread. | |
| 19 class ChromeNetBenchmarkingMessageFilter | |
| 20 : public content::BrowserMessageFilter { | |
| 21 public: | |
| 22 ChromeNetBenchmarkingMessageFilter( | |
| 23 Profile* profile, | |
| 24 net::URLRequestContextGetter* request_context); | |
| 25 | |
| 26 // content::BrowserMessageFilter methods: | |
| 27 bool OnMessageReceived(const IPC::Message& message) override; | |
| 28 void OverrideThreadForMessage(const IPC::Message& message, | |
| 29 content::BrowserThread::ID* thread) override; | |
| 30 | |
| 31 | |
| 32 private: | |
| 33 ~ChromeNetBenchmarkingMessageFilter() override; | |
| 34 | |
| 35 // Message handlers. | |
| 36 void OnCloseCurrentConnections(); | |
| 37 void OnClearCache(IPC::Message* reply_msg); | |
| 38 void OnClearHostResolverCache(); | |
| 39 void OnSetCacheMode(bool enabled); | |
| 40 void OnClearPredictorCache(); | |
| 41 | |
| 42 // Returns true if benchmarking is enabled for chrome. | |
| 43 bool CheckBenchmarkingEnabled() const; | |
| 44 | |
| 45 // The Profile associated with our renderer process. This should only be | |
| 46 // accessed on the UI thread! | |
| 47 // TODO(623967): Store the Predictor* here instead of the Profile. | |
| 48 Profile* profile_; | |
| 49 scoped_refptr<net::URLRequestContextGetter> request_context_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(ChromeNetBenchmarkingMessageFilter); | |
| 52 }; | |
| 53 | |
| 54 #endif // CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ | |
| 55 | |
| OLD | NEW |