OLD | NEW |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 rootURL.append("/"); | 81 rootURL.append("/"); |
82 rootURL.append(filesystemId); | 82 rootURL.append(filesystemId); |
83 rootURL.append("/"); | 83 rootURL.append("/"); |
84 | 84 |
85 return DOMFileSystem::create(context, filesystemName.toString(), FileSystemT
ypeIsolated, KURL(ParsedURLString, rootURL.toString())); | 85 return DOMFileSystem::create(context, filesystemName.toString(), FileSystemT
ypeIsolated, KURL(ParsedURLString, rootURL.toString())); |
86 } | 86 } |
87 | 87 |
88 DOMFileSystem::DOMFileSystem(ExecutionContext* context, const String& name, File
SystemType type, const KURL& rootURL) | 88 DOMFileSystem::DOMFileSystem(ExecutionContext* context, const String& name, File
SystemType type, const KURL& rootURL) |
89 : DOMFileSystemBase(context, name, type, rootURL) | 89 : DOMFileSystemBase(context, name, type, rootURL) |
90 , ActiveDOMObject(context) | 90 , ActiveDOMObject(context) |
| 91 , m_numberOfPendingCallbacks(0) |
91 { | 92 { |
92 ScriptWrappable::init(this); | 93 ScriptWrappable::init(this); |
93 } | 94 } |
94 | 95 |
95 PassRefPtrWillBeRawPtr<DirectoryEntry> DOMFileSystem::root() | 96 PassRefPtrWillBeRawPtr<DirectoryEntry> DOMFileSystem::root() |
96 { | 97 { |
97 return DirectoryEntry::create(this, DOMFilePath::root); | 98 return DirectoryEntry::create(this, DOMFilePath::root); |
98 } | 99 } |
99 | 100 |
100 void DOMFileSystem::addPendingCallbacks() | 101 void DOMFileSystem::addPendingCallbacks() |
101 { | 102 { |
102 setPendingActivity(this); | 103 ++m_numberOfPendingCallbacks; |
103 } | 104 } |
104 | 105 |
105 void DOMFileSystem::removePendingCallbacks() | 106 void DOMFileSystem::removePendingCallbacks() |
106 { | 107 { |
107 unsetPendingActivity(this); | 108 ASSERT(m_numberOfPendingCallbacks > 0); |
| 109 --m_numberOfPendingCallbacks; |
| 110 } |
| 111 |
| 112 bool DOMFileSystem::hasPendingActivity() const |
| 113 { |
| 114 ASSERT(m_numberOfPendingCallbacks >= 0); |
| 115 return m_numberOfPendingCallbacks; |
108 } | 116 } |
109 | 117 |
110 void DOMFileSystem::reportError(PassOwnPtr<ErrorCallback> errorCallback, PassRef
PtrWillBeRawPtr<FileError> fileError) | 118 void DOMFileSystem::reportError(PassOwnPtr<ErrorCallback> errorCallback, PassRef
PtrWillBeRawPtr<FileError> fileError) |
111 { | 119 { |
112 scheduleCallback(errorCallback, fileError); | 120 scheduleCallback(errorCallback, fileError); |
113 } | 121 } |
114 | 122 |
115 namespace { | 123 namespace { |
116 | 124 |
117 class ConvertToFileWriterCallback : public FileWriterBaseCallback { | 125 class ConvertToFileWriterCallback : public FileWriterBaseCallback { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 205 |
198 } // namespace | 206 } // namespace |
199 | 207 |
200 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallba
ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback) | 208 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallba
ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback) |
201 { | 209 { |
202 KURL fileSystemURL = createFileSystemURL(fileEntry); | 210 KURL fileSystemURL = createFileSystemURL(fileEntry); |
203 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC
allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa
llback)); | 211 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC
allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa
llback)); |
204 } | 212 } |
205 | 213 |
206 } // namespace WebCore | 214 } // namespace WebCore |
OLD | NEW |