summaryrefslogtreecommitdiff
path: root/chromium/content/browser/indexed_db
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/indexed_db')
-rw-r--r--chromium/content/browser/indexed_db/indexed_db_browsertest.cc3
-rw-r--r--chromium/content/browser/indexed_db/indexed_db_internals_ui.cc5
-rw-r--r--chromium/content/browser/indexed_db/indexed_db_leveldb_coding.cc62
-rw-r--r--chromium/content/browser/indexed_db/indexed_db_leveldb_coding.h4
4 files changed, 32 insertions, 42 deletions
diff --git a/chromium/content/browser/indexed_db/indexed_db_browsertest.cc b/chromium/content/browser/indexed_db/indexed_db_browsertest.cc
index ac541e761d3..ab010cbd92a 100644
--- a/chromium/content/browser/indexed_db/indexed_db_browsertest.cc
+++ b/chromium/content/browser/indexed_db/indexed_db_browsertest.cc
@@ -46,8 +46,7 @@ class IndexedDBBrowserTest : public ContentBrowserTest {
LOG(INFO) << "Navigating to URL and blocking.";
NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2);
LOG(INFO) << "Navigation done.";
- std::string result =
- the_browser->web_contents()->GetLastCommittedURL().ref();
+ std::string result = the_browser->web_contents()->GetURL().ref();
if (result != "pass") {
std::string js_result;
ASSERT_TRUE(ExecuteScriptAndExtractString(
diff --git a/chromium/content/browser/indexed_db/indexed_db_internals_ui.cc b/chromium/content/browser/indexed_db/indexed_db_internals_ui.cc
index 230b7887552..a5c90c4117f 100644
--- a/chromium/content/browser/indexed_db/indexed_db_internals_ui.cc
+++ b/chromium/content/browser/indexed_db/indexed_db_internals_ui.cc
@@ -257,6 +257,9 @@ void IndexedDBInternalsUI::ForceCloseOriginOnIndexedDBThread(
void IndexedDBInternalsUI::OnForcedClose(const base::FilePath& partition_path,
const GURL& origin_url,
size_t connection_count) {
+
+ scoped_refptr<IndexedDBContextImpl> context;
+
web_ui()->CallJavascriptFunction(
"indexeddb.onForcedClose",
base::StringValue(partition_path.value()),
@@ -278,7 +281,7 @@ void IndexedDBInternalsUI::OnDownloadDataReady(
DownloadUrlParameters::FromWebContents(web_ui()->GetWebContents(), url));
DownloadManager* dlm = BrowserContext::GetDownloadManager(browser_context);
- const GURL referrer(web_ui()->GetWebContents()->GetLastCommittedURL());
+ const GURL referrer(web_ui()->GetWebContents()->GetURL());
dl_params->set_referrer(
content::Referrer(referrer, WebKit::WebReferrerPolicyDefault));
diff --git a/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.cc b/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.cc
index 61d32db9047..0086b82390a 100644
--- a/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.cc
+++ b/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.cc
@@ -744,10 +744,7 @@ int CompareEncodedIDBKeys(const std::string& key_a,
namespace {
template <typename KeyType>
-int Compare(const StringPiece& a,
- const StringPiece& b,
- bool only_compare_index_keys,
- bool* ok) {
+int Compare(const StringPiece& a, const StringPiece& b, bool, bool* ok) {
KeyType key_a;
KeyType key_b;
@@ -769,7 +766,7 @@ int Compare(const StringPiece& a,
template <>
int Compare<ExistsEntryKey>(const StringPiece& a,
const StringPiece& b,
- bool only_compare_index_keys,
+ bool,
bool* ok) {
KeyPrefix prefix_a;
KeyPrefix prefix_b;
@@ -796,7 +793,7 @@ int Compare<ExistsEntryKey>(const StringPiece& a,
template <>
int Compare<ObjectStoreDataKey>(const StringPiece& a,
const StringPiece& b,
- bool only_compare_index_keys,
+ bool,
bool* ok) {
KeyPrefix prefix_a;
KeyPrefix prefix_b;
@@ -823,7 +820,7 @@ int Compare<ObjectStoreDataKey>(const StringPiece& a,
template <>
int Compare<IndexDataKey>(const StringPiece& a,
const StringPiece& b,
- bool only_compare_index_keys,
+ bool ignore_duplicates,
bool* ok) {
KeyPrefix prefix_a;
KeyPrefix prefix_b;
@@ -848,7 +845,7 @@ int Compare<IndexDataKey>(const StringPiece& a,
int result = CompareEncodedIDBKeys(&slice_a, &slice_b, ok);
if (!*ok || result)
return result;
- if (only_compare_index_keys)
+ if (ignore_duplicates)
return 0;
// sequence number [optional]
@@ -880,7 +877,7 @@ int Compare<IndexDataKey>(const StringPiece& a,
int Compare(const StringPiece& a,
const StringPiece& b,
- bool only_compare_index_keys,
+ bool index_keys,
bool* ok) {
StringPiece slice_a(a);
StringPiece slice_b(b);
@@ -921,12 +918,11 @@ int Compare(const StringPiece& a,
if (type_byte_a < kMaxSimpleGlobalMetaDataTypeByte)
return 0;
+ const bool ignore_duplicates = false;
if (type_byte_a == kDatabaseFreeListTypeByte)
- return Compare<DatabaseFreeListKey>(
- a, b, only_compare_index_keys, ok);
+ return Compare<DatabaseFreeListKey>(a, b, ignore_duplicates, ok);
if (type_byte_a == kDatabaseNameTypeByte)
- return Compare<DatabaseNameKey>(
- a, b, /*only_compare_index_keys*/ false, ok);
+ return Compare<DatabaseNameKey>(a, b, ignore_duplicates, ok);
break;
}
@@ -951,24 +947,19 @@ int Compare(const StringPiece& a,
if (type_byte_a < DatabaseMetaDataKey::MAX_SIMPLE_METADATA_TYPE)
return 0;
+ const bool ignore_duplicates = false;
if (type_byte_a == kObjectStoreMetaDataTypeByte)
- return Compare<ObjectStoreMetaDataKey>(
- a, b, only_compare_index_keys, ok);
+ return Compare<ObjectStoreMetaDataKey>(a, b, ignore_duplicates, ok);
if (type_byte_a == kIndexMetaDataTypeByte)
- return Compare<IndexMetaDataKey>(
- a, b, /*only_compare_index_keys*/ false, ok);
+ return Compare<IndexMetaDataKey>(a, b, ignore_duplicates, ok);
if (type_byte_a == kObjectStoreFreeListTypeByte)
- return Compare<ObjectStoreFreeListKey>(
- a, b, only_compare_index_keys, ok);
+ return Compare<ObjectStoreFreeListKey>(a, b, ignore_duplicates, ok);
if (type_byte_a == kIndexFreeListTypeByte)
- return Compare<IndexFreeListKey>(
- a, b, /*only_compare_index_keys*/ false, ok);
+ return Compare<IndexFreeListKey>(a, b, ignore_duplicates, ok);
if (type_byte_a == kObjectStoreNamesTypeByte)
- return Compare<ObjectStoreNamesKey>(
- a, b, only_compare_index_keys, ok);
+ return Compare<ObjectStoreNamesKey>(a, b, ignore_duplicates, ok);
if (type_byte_a == kIndexNamesKeyTypeByte)
- return Compare<IndexNamesKey>(
- a, b, /*only_compare_index_keys*/ false, ok);
+ return Compare<IndexNamesKey>(a, b, ignore_duplicates, ok);
break;
}
@@ -978,8 +969,8 @@ int Compare(const StringPiece& a,
// TODO(jsbell): This case of non-existing user keys should not have to be
// handled this way.
- return Compare<ObjectStoreDataKey>(
- a, b, /*only_compare_index_keys*/ false, ok);
+ const bool ignore_duplicates = false;
+ return Compare<ObjectStoreDataKey>(a, b, ignore_duplicates, ok);
}
case KeyPrefix::EXISTS_ENTRY: {
@@ -988,8 +979,8 @@ int Compare(const StringPiece& a,
// TODO(jsbell): This case of non-existing user keys should not have to be
// handled this way.
- return Compare<ExistsEntryKey>(
- a, b, /*only_compare_index_keys*/ false, ok);
+ const bool ignore_duplicates = false;
+ return Compare<ExistsEntryKey>(a, b, ignore_duplicates, ok);
}
case KeyPrefix::INDEX_DATA: {
@@ -998,7 +989,8 @@ int Compare(const StringPiece& a,
// TODO(jsbell): This case of non-existing user keys should not have to be
// handled this way.
- return Compare<IndexDataKey>(a, b, only_compare_index_keys, ok);
+ bool ignore_duplicates = index_keys;
+ return Compare<IndexDataKey>(a, b, ignore_duplicates, ok);
}
case KeyPrefix::INVALID_TYPE:
@@ -1012,11 +1004,9 @@ int Compare(const StringPiece& a,
} // namespace
-int Compare(const StringPiece& a,
- const StringPiece& b,
- bool only_compare_index_keys) {
+int Compare(const StringPiece& a, const StringPiece& b, bool index_keys) {
bool ok;
- int result = Compare(a, b, only_compare_index_keys, &ok);
+ int result = Compare(a, b, index_keys, &ok);
DCHECK(ok);
if (!ok)
return 0;
@@ -1792,7 +1782,7 @@ std::string IndexDataKey::EncodeMaxKey(int64 database_id,
}
int IndexDataKey::Compare(const IndexDataKey& other,
- bool only_compare_index_keys,
+ bool ignore_duplicates,
bool* ok) {
DCHECK_GE(database_id_, 0);
DCHECK_GE(object_store_id_, 0);
@@ -1801,7 +1791,7 @@ int IndexDataKey::Compare(const IndexDataKey& other,
CompareEncodedIDBKeys(encoded_user_key_, other.encoded_user_key_, ok);
if (!*ok || result)
return result;
- if (only_compare_index_keys)
+ if (ignore_duplicates)
return 0;
result = CompareEncodedIDBKeys(
encoded_primary_key_, other.encoded_primary_key_, ok);
diff --git a/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.h b/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.h
index 974c27a4fa2..ecd8b9b2d99 100644
--- a/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.h
+++ b/chromium/content/browser/indexed_db/indexed_db_leveldb_coding.h
@@ -402,9 +402,7 @@ class IndexDataKey {
CONTENT_EXPORT static std::string EncodeMaxKey(int64 database_id,
int64 object_store_id,
int64 index_id);
- int Compare(const IndexDataKey& other,
- bool only_compare_index_keys,
- bool* ok);
+ int Compare(const IndexDataKey& other, bool ignore_duplicates, bool* ok);
int64 DatabaseId() const;
int64 ObjectStoreId() const;
int64 IndexId() const;