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

Unified Diff: webkit/fileapi/isolated_context.cc

Issue 10658029: Revert 144115 - Manage IsolatedContext with reference counts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | « webkit/fileapi/isolated_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/isolated_context.cc
===================================================================
--- webkit/fileapi/isolated_context.cc (revision 144132)
+++ webkit/fileapi/isolated_context.cc (working copy)
@@ -29,8 +29,10 @@
PathMap toplevels;
for (std::set<FilePath>::const_iterator iter = files.begin();
iter != files.end(); ++iter) {
- // The given path should not contain any '..' and must be an absolute path.
- DCHECK(!iter->ReferencesParent() && iter->IsAbsolute());
+ // If the given path contains any '..' or is not an absolute path,
+ // return an empty (invalid) id.
+ if (iter->ReferencesParent() || !iter->IsAbsolute())
+ return std::string();
// Register the basename -> fullpath map. (We only expose the basename
// part to the user scripts)
@@ -41,36 +43,17 @@
toplevels.insert(std::make_pair(basename, fullpath));
}
toplevel_map_[filesystem_id] = toplevels;
-
- // Each file system is created with refcount == 0.
- ref_counts_[filesystem_id] = 0;
-
return filesystem_id;
}
+// Revoke any registered drag context for the child_id.
void IsolatedContext::RevokeIsolatedFileSystem(
const std::string& filesystem_id) {
base::AutoLock locker(lock_);
- RevokeWithoutLocking(filesystem_id);
+ toplevel_map_.erase(filesystem_id);
+ writable_ids_.erase(filesystem_id);
}
-void IsolatedContext::AddReference(const std::string& filesystem_id) {
- base::AutoLock locker(lock_);
- DCHECK(ref_counts_.find(filesystem_id) != ref_counts_.end());
- ref_counts_[filesystem_id]++;
-}
-
-void IsolatedContext::RemoveReference(const std::string& filesystem_id) {
- base::AutoLock locker(lock_);
- // This could get called for non-existent filesystem if it has been
- // already deleted by RevokeIsolatedFileSystem.
- if (ref_counts_.find(filesystem_id) == ref_counts_.end())
- return;
- DCHECK(ref_counts_[filesystem_id] > 0);
- if (--ref_counts_[filesystem_id] == 0)
- RevokeWithoutLocking(filesystem_id);
-}
-
bool IsolatedContext::CrackIsolatedPath(const FilePath& virtual_path,
std::string* filesystem_id,
FilePath* root_path,
@@ -164,13 +147,6 @@
IsolatedContext::~IsolatedContext() {
}
-void IsolatedContext::RevokeWithoutLocking(
- const std::string& filesystem_id) {
- toplevel_map_.erase(filesystem_id);
- writable_ids_.erase(filesystem_id);
- ref_counts_.erase(filesystem_id);
-}
-
std::string IsolatedContext::GetNewFileSystemId() const {
// Returns an arbitrary random string which must be unique in the map.
uint32 random_data[4];
« no previous file with comments | « webkit/fileapi/isolated_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698