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

Side by Side Diff: chrome/browser/instant/instant_io_context.h

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include nit Created 7 years, 9 months 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 | Annotate | Revision Log
OLDNEW
(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 // IO thread data held for Instant. This reflects the data held in
22 // InstantService for use on the IO thread. Owned by ResourceContext
23 // as user data.
24 class InstantIOContext : public base::SupportsUserData::Data {
25 public:
26 InstantIOContext();
27 virtual ~InstantIOContext();
28
29 // Add and remove RenderProcessHost IDs that are associated with Instant
30 // processes. Used to keep process ids in sync with InstantService.
31 static void AddInstantProcessOnIO(content::ResourceContext* context,
32 int process_id);
33 static void RemoveInstantProcessOnIO(content::ResourceContext* context,
34 int process_id);
35 static void ClearInstantProcessesOnIO(content::ResourceContext* context);
36
37 // Determine if this chrome-search: request is coming from an Instant render
38 // process.
39 static bool ShouldServiceRequest(const net::URLRequest* request);
40
41 private:
42 // Check that |process_id| is in the known set of Instant processes, ie.
43 // |process_ids_|.
44 void AddInstantProcess(int process_id);
45 void RemoveInstantProcess(int process_id);
46 bool IsInstantProcess(int process_id) const;
47 void ClearInstantProcesses();
48
49 // The process ids associated with Instant processes. Mirror of the process
50 // ids in InstantService. Duplicated here for synchronous access on the IO
51 // thread.
52 std::set<int> process_ids_;
53
54 DISALLOW_COPY_AND_ASSIGN(InstantIOContext);
55 };
56
57 #endif // CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698