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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp

Issue 2583093002: Reduce SuspendableObjects (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "wtf/text/WTFString.h" 49 #include "wtf/text/WTFString.h"
50 #include <memory> 50 #include <memory>
51 51
52 namespace blink { 52 namespace blink {
53 53
54 // static 54 // static
55 DOMFileSystem* DOMFileSystem::create(ExecutionContext* context, 55 DOMFileSystem* DOMFileSystem::create(ExecutionContext* context,
56 const String& name, 56 const String& name,
57 FileSystemType type, 57 FileSystemType type,
58 const KURL& rootURL) { 58 const KURL& rootURL) {
59 DOMFileSystem* fileSystem(new DOMFileSystem(context, name, type, rootURL)); 59 return new DOMFileSystem(context, name, type, rootURL);
60 fileSystem->suspendIfNeeded();
61 return fileSystem;
62 } 60 }
63 61
64 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem( 62 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(
65 ExecutionContext* context, 63 ExecutionContext* context,
66 const String& filesystemId) { 64 const String& filesystemId) {
67 if (filesystemId.isEmpty()) 65 if (filesystemId.isEmpty())
68 return 0; 66 return 0;
69 67
70 StringBuilder filesystemName; 68 StringBuilder filesystemName;
71 filesystemName.append(Platform::current()->fileSystemCreateOriginIdentifier( 69 filesystemName.append(Platform::current()->fileSystemCreateOriginIdentifier(
(...skipping 15 matching lines...) Expand all
87 return DOMFileSystem::create(context, filesystemName.toString(), 85 return DOMFileSystem::create(context, filesystemName.toString(),
88 FileSystemTypeIsolated, 86 FileSystemTypeIsolated,
89 KURL(ParsedURLString, rootURL.toString())); 87 KURL(ParsedURLString, rootURL.toString()));
90 } 88 }
91 89
92 DOMFileSystem::DOMFileSystem(ExecutionContext* context, 90 DOMFileSystem::DOMFileSystem(ExecutionContext* context,
93 const String& name, 91 const String& name,
94 FileSystemType type, 92 FileSystemType type,
95 const KURL& rootURL) 93 const KURL& rootURL)
96 : DOMFileSystemBase(context, name, type, rootURL), 94 : DOMFileSystemBase(context, name, type, rootURL),
97 SuspendableObject(context), 95 ContextLifecycleObserver(context),
98 m_numberOfPendingCallbacks(0), 96 m_numberOfPendingCallbacks(0),
99 m_rootEntry(DirectoryEntry::create(this, DOMFilePath::root)) {} 97 m_rootEntry(DirectoryEntry::create(this, DOMFilePath::root)) {}
100 98
101 DirectoryEntry* DOMFileSystem::root() const { 99 DirectoryEntry* DOMFileSystem::root() const {
102 return m_rootEntry.get(); 100 return m_rootEntry.get();
103 } 101 }
104 102
105 void DOMFileSystem::addPendingCallbacks() { 103 void DOMFileSystem::addPendingCallbacks() {
106 ++m_numberOfPendingCallbacks; 104 ++m_numberOfPendingCallbacks;
107 } 105 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 184 }
187 185
188 fileSystem()->createSnapshotFileAndReadMetadata( 186 fileSystem()->createSnapshotFileAndReadMetadata(
189 fileSystemURL, 187 fileSystemURL,
190 SnapshotFileCallback::create(this, fileEntry->name(), fileSystemURL, 188 SnapshotFileCallback::create(this, fileEntry->name(), fileSystemURL,
191 successCallback, errorCallback, m_context)); 189 successCallback, errorCallback, m_context));
192 } 190 }
193 191
194 DEFINE_TRACE(DOMFileSystem) { 192 DEFINE_TRACE(DOMFileSystem) {
195 DOMFileSystemBase::trace(visitor); 193 DOMFileSystemBase::trace(visitor);
196 SuspendableObject::trace(visitor); 194 ContextLifecycleObserver::trace(visitor);
197 visitor->trace(m_rootEntry); 195 visitor->trace(m_rootEntry);
198 } 196 }
199 197
200 } // namespace blink 198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698