| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 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_INSTANT_INSTANT_IO_CONTEXT_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/supports_user_data.h" |
| 12 |
| 13 namespace content { |
| 14 class ResourceContext; |
| 15 } |
| 16 |
| 17 namespace net { |
| 18 class URLRequest; |
| 19 } |
| 20 |
| 21 class InstantIOContext : public base::SupportsUserData::Data { |
| 22 public: |
| 23 InstantIOContext(); |
| 24 ~InstantIOContext(); |
| 25 |
| 26 // Add and remove RenderProcessHost IDs that are associated with Instant |
| 27 // processes. Used to keep process ids in sync with InstantService. |
| 28 static void AddInstantProcessOnIO(content::ResourceContext* context, |
| 29 int process_id); |
| 30 static void RemoveInstantProcessOnIO(content::ResourceContext* context, |
| 31 int process_id); |
| 32 static void ClearInstantProcessesOnIO(content::ResourceContext* context); |
| 33 |
| 34 // Determine if this chrome-search: request is coming from an Instant render |
| 35 // process. |
| 36 static bool ShouldServiceRequest(const net::URLRequest* request); |
| 37 |
| 38 private: |
| 39 // Check that |process_id| is in the known set of Instant processes, ie. |
| 40 // |process_ids_|. |
| 41 void AddInstantProcess(int process_id); |
| 42 void RemoveInstantProcess(int process_id); |
| 43 bool IsInstantProcess(int process_id) const; |
| 44 void ClearInstantProcesses(); |
| 45 |
| 46 // The process ids associated with Instant processes. Mirror of the process |
| 47 // ids in InstantService. Duplicated here for synchronous access on the IO |
| 48 // thread. |
| 49 std::set<int> process_ids_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(InstantIOContext); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_ |
| OLD | NEW |