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

Unified Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 6201005: Initial support for partitioning cookies for isolated apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix automation_util and thread issue. Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/sqlite_persistent_cookie_store.cc
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index 6b92bfd2128b45c7f2ab55b921894128727807cf..f118744291170cca27d5bdf191db3df873c85a07 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -18,6 +18,7 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
#include "content/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
@@ -156,6 +157,15 @@ bool SQLitePersistentCookieStore::Backend::Load(
// This function should be called only once per instance.
DCHECK(!db_.get());
+ // Ensure the parent directory for storing cookies is created before reading
+ // from it. We make an exception to allow IO on the UI thread here because
+ // we are going to disk anyway in db_->Open. (This code will be moved to the
+ // DB thread as part of http://crbug.com/52909.)
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
Matt Perry 2011/03/08 21:27:56 put this new code in an indented scope to limit th
Charlie Reis 2011/03/08 22:26:58 Done.
+ const FilePath dir = path_.DirName();
+ if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir))
+ return false;
+
db_.reset(new sql::Connection);
if (!db_->Open(path_)) {
NOTREACHED() << "Unable to open cookie DB.";

Powered by Google App Engine
This is Rietveld 408576698