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

Side by Side Diff: chrome/renderer/instant_restricted_id_cache.h

Issue 2122903002: Move search-related files from chrome/common to chrome/common/search (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move search-related files Created 4 years, 5 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
« no previous file with comments | « chrome/common/search_urls_unittest.cc ('k') | chrome/renderer/searchbox/search_bouncer.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_RENDERER_INSTANT_RESTRICTED_ID_CACHE_H_ 5 #ifndef CHROME_RENDERER_INSTANT_RESTRICTED_ID_CACHE_H_
6 #define CHROME_RENDERER_INSTANT_RESTRICTED_ID_CACHE_H_ 6 #define CHROME_RENDERER_INSTANT_RESTRICTED_ID_CACHE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/containers/mru_cache.h" 14 #include "base/containers/mru_cache.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "chrome/common/instant_types.h" 18 #include "chrome/common/search/instant_types.h"
19 19
20 // In InstantExtended, iframes are used to display objects which can only be 20 // In InstantExtended, iframes are used to display objects which can only be
21 // referenced by the Instant page using an ID (restricted ID). These IDs need to 21 // referenced by the Instant page using an ID (restricted ID). These IDs need to
22 // be unique and cached for a while so that the SearchBox API can fetch the 22 // be unique and cached for a while so that the SearchBox API can fetch the
23 // object info based on the ID when required by the Instant page. The reason to 23 // object info based on the ID when required by the Instant page. The reason to
24 // use a cache of N items as against just the last set of results is that there 24 // use a cache of N items as against just the last set of results is that there
25 // may be race conditions - e.g. the user clicks on a result being shown but the 25 // may be race conditions - e.g. the user clicks on a result being shown but the
26 // result set has internally changed but not yet been displayed. 26 // result set has internally changed but not yet been displayed.
27 // 27 //
28 // The cache can be used in two modes: 28 // The cache can be used in two modes:
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 DCHECK(item); 159 DCHECK(item);
160 160
161 typename CacheImpl::const_iterator cache_it = cache_.Peek(restricted_id); 161 typename CacheImpl::const_iterator cache_it = cache_.Peek(restricted_id);
162 if (cache_it == cache_.end()) 162 if (cache_it == cache_.end())
163 return false; 163 return false;
164 *item = cache_it->second; 164 *item = cache_it->second;
165 return true; 165 return true;
166 } 166 }
167 167
168 #endif // CHROME_RENDERER_INSTANT_RESTRICTED_ID_CACHE_H_ 168 #endif // CHROME_RENDERER_INSTANT_RESTRICTED_ID_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/common/search_urls_unittest.cc ('k') | chrome/renderer/searchbox/search_bouncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698