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

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

Issue 12498002: InstantExtended: Adding InstantRestrictedIDCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging David's and Sreeram's changes. 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
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_INSTANT_INSTANT_IO_CONTEXT_ 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_
6 #define CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_ 6 #define CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_
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 const std::vector<InstantMostVisitedItemIDPair>& items);
dhollowa 2013/03/14 00:02:43 This can't be a const-ref since you'll have a dang
Shishir 2013/03/14 19:53:03 Done.
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 // Returns true if the |restricted_id| is known, and |url| is set. Returns
dhollowa 2013/03/14 00:02:43 From prior review, this comment was meant to chang
Shishir 2013/03/14 19:53:03 Done.
70 // Returns false otherwise. 64 // false otherwise.
71 static bool GetURLForMostVisitedItemId( 65 static bool GetURLForMostVisitedItemID(const net::URLRequest* request,
72 const net::URLRequest* request, 66 InstantRestrictedID restricted_id,
73 uint64 most_visited_item_id, GURL* url); 67 GURL* url);
74 68
75 protected: 69 protected:
76 virtual ~InstantIOContext(); 70 virtual ~InstantIOContext();
77 71
78 private: 72 private:
79 friend class base::RefCountedThreadSafe<InstantIOContext>; 73 friend class base::RefCountedThreadSafe<InstantIOContext>;
80 74
81 // Check that |process_id| is in the known set of Instant processes, ie. 75 // Check that |process_id| is in the known set of Instant processes, ie.
82 // |process_ids_|. 76 // |process_ids_|.
83 bool IsInstantProcess(int process_id) const; 77 bool IsInstantProcess(int process_id) const;
84 78
85 bool GetURLForMostVisitedItemId(uint64 most_visited_item_id, GURL* url); 79 bool GetURLForMostVisitedItemID(InstantRestrictedID restricted_id,
80 GURL* url) const;
86 81
87 // The process IDs associated with Instant processes. Mirror of the process 82 // The process IDs associated with Instant processes. Mirror of the process
88 // IDs in InstantService. Duplicated here for synchronous access on the IO 83 // IDs in InstantService. Duplicated here for synchronous access on the IO
89 // thread. 84 // thread.
90 std::set<int> process_ids_; 85 std::set<int> process_ids_;
91 86
92 // The Most Visited item IDs map associated with Instant processes. Mirror of 87 // 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 88 // InstantService. Duplicated here for synchronous access on the IO thread.
94 // synchronous access on the IO thread. 89 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_item_cache_;
95 std::map<uint64, GURL> most_visited_item_id_to_url_map_;
96 90
97 DISALLOW_COPY_AND_ASSIGN(InstantIOContext); 91 DISALLOW_COPY_AND_ASSIGN(InstantIOContext);
98 }; 92 };
99 93
100 #endif // CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_ 94 #endif // CHROME_BROWSER_INSTANT_INSTANT_IO_CONTEXT_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698