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

Unified Diff: webkit/appcache/appcache_database.cc

Issue 13881003: AppCacheExecutableHandlers - parse manifest file and store the 'bit' indicating executable. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/appcache/appcache_entry.h » ('j') | webkit/appcache/appcache_interfaces.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_database.cc
===================================================================
--- webkit/appcache/appcache_database.cc (revision 194203)
+++ webkit/appcache/appcache_database.cc (working copy)
@@ -5,6 +5,7 @@
#include "webkit/appcache/appcache_database.h"
#include "base/auto_reset.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
@@ -15,6 +16,8 @@
#include "webkit/appcache/appcache_entry.h"
#include "webkit/appcache/appcache_histograms.h"
+namespace appcache {
+
// Schema -------------------------------------------------------------------
namespace {
@@ -167,13 +170,14 @@
}
std::string GetActiveExperimentFlags() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(kEnableExecutableHandlers))
+ return std::string("executableHandlersEnabled");
return std::string();
}
} // anon namespace
// AppCacheDatabase ----------------------------------------------------------
-namespace appcache {
AppCacheDatabase::GroupRecord::GroupRecord()
: group_id(0) {
@@ -700,10 +704,19 @@
" (cache_id, origin, type, namespace_url, target_url, is_pattern)"
" VALUES (?, ?, ?, ?, ?, ?)";
+ // Note: quick and dirty storage for the 'executable' bit w/o changing
+ // schemas, we use the high bit of 'type' field.
+ int type_with_executable_bit = record->namespace_.type;
+ if (record->namespace_.is_executable) {
+ type_with_executable_bit |= 0x8000000;
+ DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(
+ kEnableExecutableHandlers));
+ }
+
sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql));
statement.BindInt64(0, record->cache_id);
statement.BindString(1, record->origin.spec());
- statement.BindInt(2, record->namespace_.type);
+ statement.BindInt(2, type_with_executable_bit);
statement.BindString(3, record->namespace_.namespace_url.spec());
statement.BindString(4, record->namespace_.target_url.spec());
statement.BindBool(5, record->namespace_.is_pattern);
@@ -947,10 +960,19 @@
const sql::Statement* statement, NamespaceRecord* record) {
record->cache_id = statement->ColumnInt64(0);
record->origin = GURL(statement->ColumnString(1));
- record->namespace_.type = static_cast<NamespaceType>(statement->ColumnInt(2));
+ int type_with_executable_bit = statement->ColumnInt(2);
michaeln 2013/04/16 22:25:11 could make this const to make it more clear we don
record->namespace_.namespace_url = GURL(statement->ColumnString(3));
record->namespace_.target_url = GURL(statement->ColumnString(4));
record->namespace_.is_pattern = statement->ColumnBool(5);
+
+ // Note: quick and dirty storage for the 'executable' bit w/o changing
+ // schemas, we use the high bit of 'type' field.
+ record->namespace_.type = static_cast<NamespaceType>
+ (type_with_executable_bit & 0x7ffffff);
+ record->namespace_.is_executable =
+ (type_with_executable_bit & 0x80000000) != 0;
+ DCHECK(!record->namespace_.is_executable ||
+ CommandLine::ForCurrentProcess()->HasSwitch(kEnableExecutableHandlers));
}
void AppCacheDatabase::ReadOnlineWhiteListRecord(
« no previous file with comments | « no previous file | webkit/appcache/appcache_entry.h » ('j') | webkit/appcache/appcache_interfaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698