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

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

Issue 12498002: InstantExtended: Adding InstantRestrictedIDCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing android compile error. 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
« no previous file with comments | « no previous file | chrome/browser/search/instant_io_context.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 2013 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_SEARCH_INSTANT_IO_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_SEARCH_INSTANT_IO_CONTEXT_H_
6 #define CHROME_BROWSER_SEARCH_INSTANT_IO_CONTEXT_H_ 6 #define CHROME_BROWSER_SEARCH_INSTANT_IO_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "chrome/common/instant_restricted_id_cache.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace content { 18 namespace content {
18 class ResourceContext; 19 class ResourceContext;
19 } 20 }
20 21
21 namespace net { 22 namespace net {
22 class URLRequest; 23 class URLRequest;
23 } 24 }
(...skipping 20 matching lines...) Expand all
44 static void AddInstantProcessOnIO( 45 static void AddInstantProcessOnIO(
45 scoped_refptr<InstantIOContext> instant_io_context, 46 scoped_refptr<InstantIOContext> instant_io_context,
46 int process_id); 47 int process_id);
47 static void RemoveInstantProcessOnIO( 48 static void RemoveInstantProcessOnIO(
48 scoped_refptr<InstantIOContext> instant_io_context, 49 scoped_refptr<InstantIOContext> instant_io_context,
49 int process_id); 50 int process_id);
50 static void ClearInstantProcessesOnIO( 51 static void ClearInstantProcessesOnIO(
51 scoped_refptr<InstantIOContext> instant_io_context); 52 scoped_refptr<InstantIOContext> instant_io_context);
52 53
53 // Associates the |most_visited_item_id| with the |url|. 54 // Associates the |most_visited_item_id| with the |url|.
54 static void AddMostVisitedItemIDOnIO( 55 static void AddMostVisitedItemsOnIO(
55 scoped_refptr<InstantIOContext> instant_io_context, 56 scoped_refptr<InstantIOContext> instant_io_context,
56 uint64 most_visited_item_id, const GURL& url); 57 std::vector<InstantMostVisitedItemIDPair> items);
57
58 // Deletes the Most Visited item IDs contained in |deleted_ids| from the url
59 // mapping. If |all_history| is true, then ignores |deleted_ids| and
60 // deletes all mappings.
61 static void DeleteMostVisitedURLsOnIO(
62 scoped_refptr<InstantIOContext> instant_io_context,
63 std::vector<uint64> deleted_ids, bool all_history);
64 58
65 // Determine if this chrome-search: request is coming from an Instant render 59 // Determine if this chrome-search: request is coming from an Instant render
66 // process. 60 // process.
67 static bool ShouldServiceRequest(const net::URLRequest* request); 61 static bool ShouldServiceRequest(const net::URLRequest* request);
68 62
69 // Returns true if the |most_visited_item_id| is known, and |url| is set. 63 // If there is a mapping for the |most_visited_item_id|, sets |url| and
70 // Returns false otherwise. 64 // returns true.
71 static bool GetURLForMostVisitedItemId( 65 static bool GetURLForMostVisitedItemID(
72 const net::URLRequest* request, 66 const net::URLRequest* request,
73 uint64 most_visited_item_id, GURL* url); 67 InstantRestrictedID most_visited_item_id,
68 GURL* url);
74 69
75 protected: 70 protected:
76 virtual ~InstantIOContext(); 71 virtual ~InstantIOContext();
77 72
78 private: 73 private:
79 friend class base::RefCountedThreadSafe<InstantIOContext>; 74 friend class base::RefCountedThreadSafe<InstantIOContext>;
80 75
81 // Check that |process_id| is in the known set of Instant processes, ie. 76 // Check that |process_id| is in the known set of Instant processes, ie.
82 // |process_ids_|. 77 // |process_ids_|.
83 bool IsInstantProcess(int process_id) const; 78 bool IsInstantProcess(int process_id) const;
84 79
85 bool GetURLForMostVisitedItemId(uint64 most_visited_item_id, GURL* url); 80 bool GetURLForMostVisitedItemID(InstantRestrictedID most_visited_item_id,
81 GURL* url) const;
86 82
87 // The process IDs associated with Instant processes. Mirror of the process 83 // The process IDs associated with Instant processes. Mirror of the process
88 // IDs in InstantService. Duplicated here for synchronous access on the IO 84 // IDs in InstantService. Duplicated here for synchronous access on the IO
89 // thread. 85 // thread.
90 std::set<int> process_ids_; 86 std::set<int> process_ids_;
91 87
92 // The Most Visited item IDs map associated with Instant processes. Mirror of 88 // The Most Visited item cache. Mirror of the Most Visited item cache in
93 // the Most Visited item ID map in InstantService. Duplicated here for 89 // InstantService. Duplicated here for synchronous access on the IO thread.
94 // synchronous access on the IO thread. 90 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_item_cache_;
95 std::map<uint64, GURL> most_visited_item_id_to_url_map_;
96 91
97 DISALLOW_COPY_AND_ASSIGN(InstantIOContext); 92 DISALLOW_COPY_AND_ASSIGN(InstantIOContext);
98 }; 93 };
99 94
100 #endif // CHROME_BROWSER_SEARCH_INSTANT_IO_CONTEXT_H_ 95 #endif // CHROME_BROWSER_SEARCH_INSTANT_IO_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/instant_io_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698