OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled"; | 79 static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled"; |
80 } | 80 } |
81 | 81 |
82 namespace { | 82 namespace { |
83 | 83 |
84 template<typename BaseCallback, typename Handler, typename Argument> | 84 template<typename BaseCallback, typename Handler, typename Argument> |
85 class CallbackDispatcher final : public BaseCallback { | 85 class CallbackDispatcher final : public BaseCallback { |
86 public: | 86 public: |
87 typedef bool (Handler::*HandlingMethod)(Argument); | 87 typedef bool (Handler::*HandlingMethod)(Argument); |
88 | 88 |
89 static CallbackDispatcher* create(PassRefPtr<Handler> handler, HandlingMetho d handlingMethod) | 89 static CallbackDispatcher* create(PassRefPtrWillBeRawPtr<Handler> handler, H andlingMethod handlingMethod) |
90 { | 90 { |
91 return new CallbackDispatcher(handler, handlingMethod); | 91 return new CallbackDispatcher(handler, handlingMethod); |
92 } | 92 } |
93 | 93 |
94 void handleEvent(Argument argument) override | 94 void handleEvent(Argument argument) override |
95 { | 95 { |
96 (m_handler.get()->*m_handlingMethod)(argument); | 96 (m_handler.get()->*m_handlingMethod)(argument); |
97 } | 97 } |
98 | 98 |
99 DEFINE_INLINE_VIRTUAL_TRACE() | |
100 { | |
101 visitor->trace(m_handler); | |
102 BaseCallback::trace(visitor); | |
haraken
2015/07/16 11:43:25
I'm hitting the following error. It seems that the
Yuta Kitamura
2015/07/17 04:23:24
Hmm, getting this correct can be pretty hard since
| |
103 } | |
104 | |
99 private: | 105 private: |
100 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho d) | 106 CallbackDispatcher(PassRefPtrWillBeRawPtr<Handler> handler, HandlingMethod h andlingMethod) |
101 : m_handler(handler) | 107 : m_handler(handler) |
102 , m_handlingMethod(handlingMethod) { } | 108 , m_handlingMethod(handlingMethod) { } |
103 | 109 |
104 RefPtr<Handler> m_handler; | 110 RefPtrWillBeMember<Handler> m_handler; |
105 HandlingMethod m_handlingMethod; | 111 HandlingMethod m_handlingMethod; |
106 }; | 112 }; |
107 | 113 |
108 template<typename BaseCallback> | 114 template<typename BaseCallback> |
109 class CallbackDispatcherFactory { | 115 class CallbackDispatcherFactory { |
110 public: | 116 public: |
111 template<typename Handler, typename Argument> | 117 template<typename Handler, typename Argument> |
112 static CallbackDispatcher<BaseCallback, Handler, Argument>* create(Handler* handler, bool (Handler::*handlingMethod)(Argument)) | 118 static CallbackDispatcher<BaseCallback, Handler, Argument>* create(Handler* handler, bool (Handler::*handlingMethod)(Argument)) |
113 { | 119 { |
114 return CallbackDispatcher<BaseCallback, Handler, Argument>::create(PassR efPtr<Handler>(handler), handlingMethod); | 120 return CallbackDispatcher<BaseCallback, Handler, Argument>::create(PassR efPtrWillBeRawPtr<Handler>(handler), handlingMethod); |
115 } | 121 } |
116 }; | 122 }; |
117 | 123 |
118 class FileSystemRootRequest : public RefCounted<FileSystemRootRequest> { | 124 class FileSystemRootRequest final : public RefCountedWillBeGarbageCollectedFinal ized<FileSystemRootRequest> { |
119 WTF_MAKE_NONCOPYABLE(FileSystemRootRequest); | 125 WTF_MAKE_NONCOPYABLE(FileSystemRootRequest); |
120 public: | 126 public: |
121 static PassRefPtr<FileSystemRootRequest> create(PassRefPtrWillBeRawPtr<Reque stFileSystemRootCallback> requestCallback, const String& type) | 127 static PassRefPtrWillBeRawPtr<FileSystemRootRequest> create(PassRefPtrWillBe RawPtr<RequestFileSystemRootCallback> requestCallback, const String& type) |
122 { | 128 { |
123 return adoptRef(new FileSystemRootRequest(requestCallback, type)); | 129 return adoptRefWillBeNoop(new FileSystemRootRequest(requestCallback, typ e)); |
124 } | 130 } |
125 | 131 |
126 void start(ExecutionContext*); | 132 void start(ExecutionContext*); |
127 | 133 |
134 DEFINE_INLINE_TRACE() | |
135 { | |
136 visitor->trace(m_requestCallback); | |
137 } | |
138 | |
128 private: | 139 private: |
129 bool didHitError(FileError* error) | 140 bool didHitError(FileError* error) |
130 { | 141 { |
131 reportResult(error->code()); | 142 reportResult(error->code()); |
132 return true; | 143 return true; |
133 } | 144 } |
134 | 145 |
135 bool didGetEntry(Entry*); | 146 bool didGetEntry(Entry*); |
136 | 147 |
137 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::Fi leSystem::Entry> entry = nullptr) | 148 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::Fi leSystem::Entry> entry = nullptr) |
138 { | 149 { |
139 m_requestCallback->sendSuccess(static_cast<int>(errorCode), entry); | 150 m_requestCallback->sendSuccess(static_cast<int>(errorCode), entry); |
140 } | 151 } |
141 | 152 |
142 FileSystemRootRequest(PassRefPtrWillBeRawPtr<RequestFileSystemRootCallback> requestCallback, const String& type) | 153 FileSystemRootRequest(PassRefPtrWillBeRawPtr<RequestFileSystemRootCallback> requestCallback, const String& type) |
143 : m_requestCallback(requestCallback) | 154 : m_requestCallback(requestCallback) |
144 , m_type(type) { } | 155 , m_type(type) { } |
145 | 156 |
146 RefPtrWillBePersistent<RequestFileSystemRootCallback> m_requestCallback; | 157 RefPtrWillBeMember<RequestFileSystemRootCallback> m_requestCallback; |
147 String m_type; | 158 String m_type; |
148 }; | 159 }; |
149 | 160 |
150 void FileSystemRootRequest::start(ExecutionContext* executionContext) | 161 void FileSystemRootRequest::start(ExecutionContext* executionContext) |
151 { | 162 { |
152 ASSERT(executionContext); | 163 ASSERT(executionContext); |
153 | 164 |
154 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileSystemRootRequest::didHitError); | 165 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileSystemRootRequest::didHitError); |
155 | 166 |
156 FileSystemType type; | 167 FileSystemType type; |
(...skipping 16 matching lines...) Expand all Loading... | |
173 bool FileSystemRootRequest::didGetEntry(Entry* entry) | 184 bool FileSystemRootRequest::didGetEntry(Entry* entry) |
174 { | 185 { |
175 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent ry::create() | 186 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent ry::create() |
176 .setUrl(entry->toURL()) | 187 .setUrl(entry->toURL()) |
177 .setName("/") | 188 .setName("/") |
178 .setIsDirectory(true); | 189 .setIsDirectory(true); |
179 reportResult(static_cast<FileError::ErrorCode>(0), result); | 190 reportResult(static_cast<FileError::ErrorCode>(0), result); |
180 return true; | 191 return true; |
181 } | 192 } |
182 | 193 |
183 class DirectoryContentRequest final : public RefCounted<DirectoryContentRequest> { | 194 class DirectoryContentRequest final : public RefCountedWillBeGarbageCollectedFin alized<DirectoryContentRequest> { |
184 WTF_MAKE_NONCOPYABLE(DirectoryContentRequest); | 195 WTF_MAKE_NONCOPYABLE(DirectoryContentRequest); |
185 public: | 196 public: |
186 static PassRefPtr<DirectoryContentRequest> create(PassRefPtrWillBeRawPtr<Req uestDirectoryContentCallback> requestCallback, const String& url) | 197 static PassRefPtrWillBeRawPtr<DirectoryContentRequest> create(PassRefPtrWill BeRawPtr<RequestDirectoryContentCallback> requestCallback, const String& url) |
187 { | 198 { |
188 return adoptRef(new DirectoryContentRequest(requestCallback, url)); | 199 return adoptRefWillBeNoop(new DirectoryContentRequest(requestCallback, u rl)); |
189 } | 200 } |
190 | 201 |
191 ~DirectoryContentRequest() | 202 ~DirectoryContentRequest() |
192 { | 203 { |
193 reportResult(FileError::ABORT_ERR); | 204 reportResult(FileError::ABORT_ERR); |
194 } | 205 } |
195 | 206 |
196 void start(ExecutionContext*); | 207 void start(ExecutionContext*); |
197 | 208 |
209 DEFINE_INLINE_VIRTUAL_TRACE() | |
210 { | |
211 visitor->trace(m_requestCallback); | |
212 visitor->trace(m_directoryReader); | |
213 } | |
214 | |
198 private: | 215 private: |
199 bool didHitError(FileError* error) | 216 bool didHitError(FileError* error) |
200 { | 217 { |
201 reportResult(error->code()); | 218 reportResult(error->code()); |
202 return true; | 219 return true; |
203 } | 220 } |
204 | 221 |
205 bool didGetEntry(Entry*); | 222 bool didGetEntry(Entry*); |
206 bool didReadDirectoryEntries(const EntryHeapVector&); | 223 bool didReadDirectoryEntries(const EntryHeapVector&); |
207 | 224 |
208 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<Array<TypeBuild er::FileSystem::Entry>> entries = nullptr) | 225 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<Array<TypeBuild er::FileSystem::Entry>> entries = nullptr) |
209 { | 226 { |
210 m_requestCallback->sendSuccess(static_cast<int>(errorCode), entries); | 227 m_requestCallback->sendSuccess(static_cast<int>(errorCode), entries); |
211 } | 228 } |
212 | 229 |
213 DirectoryContentRequest(PassRefPtrWillBeRawPtr<RequestDirectoryContentCallba ck> requestCallback, const String& url) | 230 DirectoryContentRequest(PassRefPtrWillBeRawPtr<RequestDirectoryContentCallba ck> requestCallback, const String& url) |
214 : m_requestCallback(requestCallback) | 231 : m_requestCallback(requestCallback) |
215 , m_url(ParsedURLString, url) { } | 232 , m_url(ParsedURLString, url) { } |
216 | 233 |
217 void readDirectoryEntries(); | 234 void readDirectoryEntries(); |
218 | 235 |
219 RefPtrWillBePersistent<RequestDirectoryContentCallback> m_requestCallback; | 236 RefPtrWillBeMember<RequestDirectoryContentCallback> m_requestCallback; |
220 KURL m_url; | 237 KURL m_url; |
221 RefPtr<Array<TypeBuilder::FileSystem::Entry>> m_entries; | 238 RefPtr<Array<TypeBuilder::FileSystem::Entry>> m_entries; |
222 Persistent<DirectoryReader> m_directoryReader; | 239 PersistentWillBeMember<DirectoryReader> m_directoryReader; |
223 }; | 240 }; |
224 | 241 |
225 void DirectoryContentRequest::start(ExecutionContext* executionContext) | 242 void DirectoryContentRequest::start(ExecutionContext* executionContext) |
226 { | 243 { |
227 ASSERT(executionContext); | 244 ASSERT(executionContext); |
228 | 245 |
229 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DirectoryContentRequest::didHitError); | 246 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DirectoryContentRequest::didHitError); |
230 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &DirectoryContentRequest::didGetEntry); | 247 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &DirectoryContentRequest::didGetEntry); |
231 | 248 |
232 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); | 249 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 entryForFrontend->setMimeType(mimeType); | 311 entryForFrontend->setMimeType(mimeType); |
295 entryForFrontend->setResourceType(resourceType); | 312 entryForFrontend->setResourceType(resourceType); |
296 } | 313 } |
297 | 314 |
298 m_entries->addItem(entryForFrontend); | 315 m_entries->addItem(entryForFrontend); |
299 } | 316 } |
300 readDirectoryEntries(); | 317 readDirectoryEntries(); |
301 return true; | 318 return true; |
302 } | 319 } |
303 | 320 |
304 class MetadataRequest final : public RefCounted<MetadataRequest> { | 321 class MetadataRequest final : public RefCountedWillBeGarbageCollectedFinalized<M etadataRequest> { |
305 WTF_MAKE_NONCOPYABLE(MetadataRequest); | 322 WTF_MAKE_NONCOPYABLE(MetadataRequest); |
306 public: | 323 public: |
307 static PassRefPtr<MetadataRequest> create(PassRefPtrWillBeRawPtr<RequestMeta dataCallback> requestCallback, const String& url) | 324 static PassRefPtrWillBeRawPtr<MetadataRequest> create(PassRefPtrWillBeRawPtr <RequestMetadataCallback> requestCallback, const String& url) |
308 { | 325 { |
309 return adoptRef(new MetadataRequest(requestCallback, url)); | 326 return adoptRefWillBeNoop(new MetadataRequest(requestCallback, url)); |
310 } | 327 } |
311 | 328 |
312 ~MetadataRequest() | 329 ~MetadataRequest() |
313 { | 330 { |
314 reportResult(FileError::ABORT_ERR); | 331 reportResult(FileError::ABORT_ERR); |
315 } | 332 } |
316 | 333 |
317 void start(ExecutionContext*); | 334 void start(ExecutionContext*); |
318 | 335 |
336 DEFINE_INLINE_VIRTUAL_TRACE() | |
337 { | |
338 visitor->trace(m_requestCallback); | |
339 } | |
340 | |
319 private: | 341 private: |
320 bool didHitError(FileError* error) | 342 bool didHitError(FileError* error) |
321 { | 343 { |
322 reportResult(error->code()); | 344 reportResult(error->code()); |
323 return true; | 345 return true; |
324 } | 346 } |
325 | 347 |
326 bool didGetEntry(Entry*); | 348 bool didGetEntry(Entry*); |
327 bool didGetMetadata(Metadata*); | 349 bool didGetMetadata(Metadata*); |
328 | 350 |
329 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::Fi leSystem::Metadata> metadata = nullptr) | 351 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::Fi leSystem::Metadata> metadata = nullptr) |
330 { | 352 { |
331 m_requestCallback->sendSuccess(static_cast<int>(errorCode), metadata); | 353 m_requestCallback->sendSuccess(static_cast<int>(errorCode), metadata); |
332 } | 354 } |
333 | 355 |
334 MetadataRequest(PassRefPtrWillBeRawPtr<RequestMetadataCallback> requestCallb ack, const String& url) | 356 MetadataRequest(PassRefPtrWillBeRawPtr<RequestMetadataCallback> requestCallb ack, const String& url) |
335 : m_requestCallback(requestCallback) | 357 : m_requestCallback(requestCallback) |
336 , m_url(ParsedURLString, url) { } | 358 , m_url(ParsedURLString, url) { } |
337 | 359 |
338 RefPtrWillBePersistent<RequestMetadataCallback> m_requestCallback; | 360 RefPtrWillBeMember<RequestMetadataCallback> m_requestCallback; |
339 KURL m_url; | 361 KURL m_url; |
340 bool m_isDirectory; | 362 bool m_isDirectory; |
341 }; | 363 }; |
342 | 364 |
343 void MetadataRequest::start(ExecutionContext* executionContext) | 365 void MetadataRequest::start(ExecutionContext* executionContext) |
344 { | 366 { |
345 ASSERT(executionContext); | 367 ASSERT(executionContext); |
346 | 368 |
347 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &MetadataRequest::didHitError); | 369 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &MetadataRequest::didHitError); |
348 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &MetadataRequest::didGetEntry); | 370 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &MetadataRequest::didGetEntry); |
(...skipping 21 matching lines...) Expand all Loading... | |
370 RefPtr<Metadata> result = Metadata::create() | 392 RefPtr<Metadata> result = Metadata::create() |
371 .setModificationTime(metadata->modificationTime()) | 393 .setModificationTime(metadata->modificationTime()) |
372 .setSize(metadata->size()); | 394 .setSize(metadata->size()); |
373 reportResult(static_cast<FileError::ErrorCode>(0), result); | 395 reportResult(static_cast<FileError::ErrorCode>(0), result); |
374 return true; | 396 return true; |
375 } | 397 } |
376 | 398 |
377 class FileContentRequest final : public EventListener { | 399 class FileContentRequest final : public EventListener { |
378 WTF_MAKE_NONCOPYABLE(FileContentRequest); | 400 WTF_MAKE_NONCOPYABLE(FileContentRequest); |
379 public: | 401 public: |
380 static PassRefPtr<FileContentRequest> create(PassRefPtrWillBeRawPtr<RequestF ileContentCallback> requestCallback, const String& url, bool readAsText, long lo ng start, long long end, const String& charset) | 402 static PassRefPtrWillBeRawPtr<FileContentRequest> create(PassRefPtrWillBeRaw Ptr<RequestFileContentCallback> requestCallback, const String& url, bool readAsT ext, long long start, long long end, const String& charset) |
381 { | 403 { |
382 return adoptRef(new FileContentRequest(requestCallback, url, readAsText, start, end, charset)); | 404 return adoptRefWillBeNoop(new FileContentRequest(requestCallback, url, r eadAsText, start, end, charset)); |
383 } | 405 } |
384 | 406 |
385 ~FileContentRequest() override | 407 ~FileContentRequest() override |
386 { | 408 { |
387 reportResult(FileError::ABORT_ERR); | 409 reportResult(FileError::ABORT_ERR); |
388 } | 410 } |
389 | 411 |
390 void start(ExecutionContext*); | 412 void start(ExecutionContext*); |
391 | 413 |
392 bool operator==(const EventListener& other) override | 414 bool operator==(const EventListener& other) override |
393 { | 415 { |
394 return this == &other; | 416 return this == &other; |
395 } | 417 } |
396 | 418 |
397 void handleEvent(ExecutionContext*, Event* event) override | 419 void handleEvent(ExecutionContext*, Event* event) override |
398 { | 420 { |
399 if (event->type() == EventTypeNames::load) | 421 if (event->type() == EventTypeNames::load) |
400 didRead(); | 422 didRead(); |
401 else if (event->type() == EventTypeNames::error) | 423 else if (event->type() == EventTypeNames::error) |
402 didHitError(m_reader->error()); | 424 didHitError(m_reader->error()); |
403 } | 425 } |
404 | 426 |
427 DEFINE_INLINE_VIRTUAL_TRACE() | |
428 { | |
429 visitor->trace(m_requestCallback); | |
430 visitor->trace(m_reader); | |
431 EventListener::trace(visitor); | |
432 } | |
433 | |
405 private: | 434 private: |
406 bool didHitError(FileError* error) | 435 bool didHitError(FileError* error) |
407 { | 436 { |
408 reportResult(error->code()); | 437 reportResult(error->code()); |
409 return true; | 438 return true; |
410 } | 439 } |
411 | 440 |
412 bool didGetEntry(Entry*); | 441 bool didGetEntry(Entry*); |
413 bool didGetFile(File*); | 442 bool didGetFile(File*); |
414 void didRead(); | 443 void didRead(); |
415 | 444 |
416 void reportResult(FileError::ErrorCode errorCode, const String* result = 0, const String* charset = 0) | 445 void reportResult(FileError::ErrorCode errorCode, const String* result = 0, const String* charset = 0) |
417 { | 446 { |
418 m_requestCallback->sendSuccess(static_cast<int>(errorCode), result, char set); | 447 m_requestCallback->sendSuccess(static_cast<int>(errorCode), result, char set); |
419 } | 448 } |
420 | 449 |
421 FileContentRequest(PassRefPtrWillBeRawPtr<RequestFileContentCallback> reques tCallback, const String& url, bool readAsText, long long start, long long end, c onst String& charset) | 450 FileContentRequest(PassRefPtrWillBeRawPtr<RequestFileContentCallback> reques tCallback, const String& url, bool readAsText, long long start, long long end, c onst String& charset) |
422 : EventListener(EventListener::CPPEventListenerType) | 451 : EventListener(EventListener::CPPEventListenerType) |
423 , m_requestCallback(requestCallback) | 452 , m_requestCallback(requestCallback) |
424 , m_url(ParsedURLString, url) | 453 , m_url(ParsedURLString, url) |
425 , m_readAsText(readAsText) | 454 , m_readAsText(readAsText) |
426 , m_start(start) | 455 , m_start(start) |
427 , m_end(end) | 456 , m_end(end) |
428 , m_charset(charset) { } | 457 , m_charset(charset) { } |
429 | 458 |
430 RefPtrWillBePersistent<RequestFileContentCallback> m_requestCallback; | 459 RefPtrWillBeMember<RequestFileContentCallback> m_requestCallback; |
431 KURL m_url; | 460 KURL m_url; |
432 bool m_readAsText; | 461 bool m_readAsText; |
433 int m_start; | 462 int m_start; |
434 long long m_end; | 463 long long m_end; |
435 String m_mimeType; | 464 String m_mimeType; |
436 String m_charset; | 465 String m_charset; |
437 | 466 |
438 Persistent<FileReader> m_reader; | 467 PersistentWillBeMember<FileReader> m_reader; |
439 }; | 468 }; |
440 | 469 |
441 void FileContentRequest::start(ExecutionContext* executionContext) | 470 void FileContentRequest::start(ExecutionContext* executionContext) |
442 { | 471 { |
443 ASSERT(executionContext); | 472 ASSERT(executionContext); |
444 | 473 |
445 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileContentRequest::didHitError); | 474 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileContentRequest::didHitError); |
446 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &FileContentRequest::didGetEntry); | 475 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &FileContentRequest::didGetEntry); |
447 | 476 |
448 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); | 477 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 return; | 522 return; |
494 } | 523 } |
495 | 524 |
496 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType , m_charset, true); | 525 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType , m_charset, true); |
497 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer-> byteLength()); | 526 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer-> byteLength()); |
498 result = result + decoder->flush(); | 527 result = result + decoder->flush(); |
499 m_charset = decoder->encoding().name(); | 528 m_charset = decoder->encoding().name(); |
500 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset); | 529 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset); |
501 } | 530 } |
502 | 531 |
503 class DeleteEntryRequest final : public RefCounted<DeleteEntryRequest> { | 532 class DeleteEntryRequest final : public RefCountedWillBeGarbageCollectedFinalize d<DeleteEntryRequest> { |
504 public: | 533 public: |
505 static PassRefPtr<DeleteEntryRequest> create(PassRefPtrWillBeRawPtr<DeleteEn tryCallback> requestCallback, const KURL& url) | 534 static PassRefPtrWillBeRawPtr<DeleteEntryRequest> create(PassRefPtrWillBeRaw Ptr<DeleteEntryCallback> requestCallback, const KURL& url) |
506 { | 535 { |
507 return adoptRef(new DeleteEntryRequest(requestCallback, url)); | 536 return adoptRefWillBeNoop(new DeleteEntryRequest(requestCallback, url)); |
508 } | 537 } |
509 | 538 |
510 ~DeleteEntryRequest() | 539 ~DeleteEntryRequest() |
511 { | 540 { |
512 reportResult(FileError::ABORT_ERR); | 541 reportResult(FileError::ABORT_ERR); |
513 } | 542 } |
514 | 543 |
515 void start(ExecutionContext*); | 544 void start(ExecutionContext*); |
516 | 545 |
546 DEFINE_INLINE_TRACE() | |
547 { | |
548 visitor->trace(m_requestCallback); | |
549 } | |
550 | |
517 private: | 551 private: |
518 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods | 552 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods |
519 class VoidCallbackImpl final : public VoidCallback { | 553 class VoidCallbackImpl final : public VoidCallback { |
520 public: | 554 public: |
521 explicit VoidCallbackImpl(PassRefPtr<DeleteEntryRequest> handler) | 555 explicit VoidCallbackImpl(PassRefPtrWillBeRawPtr<DeleteEntryRequest> han dler) |
522 : m_handler(handler) | 556 : m_handler(handler) |
523 { | 557 { |
524 } | 558 } |
525 | 559 |
526 void handleEvent() override | 560 void handleEvent() override |
527 { | 561 { |
528 m_handler->didDeleteEntry(); | 562 m_handler->didDeleteEntry(); |
529 } | 563 } |
530 | 564 |
565 DEFINE_INLINE_VIRTUAL_TRACE() | |
566 { | |
567 visitor->trace(m_handler); | |
568 VoidCallback::trace(visitor); | |
569 } | |
570 | |
531 private: | 571 private: |
532 RefPtr<DeleteEntryRequest> m_handler; | 572 RefPtrWillBeMember<DeleteEntryRequest> m_handler; |
533 }; | 573 }; |
534 | 574 |
535 bool didHitError(FileError* error) | 575 bool didHitError(FileError* error) |
536 { | 576 { |
537 reportResult(error->code()); | 577 reportResult(error->code()); |
538 return true; | 578 return true; |
539 } | 579 } |
540 | 580 |
541 bool didGetEntry(Entry*); | 581 bool didGetEntry(Entry*); |
542 bool didDeleteEntry(); | 582 bool didDeleteEntry(); |
543 | 583 |
544 void reportResult(FileError::ErrorCode errorCode) | 584 void reportResult(FileError::ErrorCode errorCode) |
545 { | 585 { |
546 m_requestCallback->sendSuccess(static_cast<int>(errorCode)); | 586 m_requestCallback->sendSuccess(static_cast<int>(errorCode)); |
547 } | 587 } |
548 | 588 |
549 DeleteEntryRequest(PassRefPtrWillBeRawPtr<DeleteEntryCallback> requestCallba ck, const KURL& url) | 589 DeleteEntryRequest(PassRefPtrWillBeRawPtr<DeleteEntryCallback> requestCallba ck, const KURL& url) |
550 : m_requestCallback(requestCallback) | 590 : m_requestCallback(requestCallback) |
551 , m_url(url) { } | 591 , m_url(url) { } |
552 | 592 |
553 RefPtrWillBePersistent<DeleteEntryCallback> m_requestCallback; | 593 RefPtrWillBeMember<DeleteEntryCallback> m_requestCallback; |
554 KURL m_url; | 594 KURL m_url; |
555 }; | 595 }; |
556 | 596 |
557 void DeleteEntryRequest::start(ExecutionContext* executionContext) | 597 void DeleteEntryRequest::start(ExecutionContext* executionContext) |
558 { | 598 { |
559 ASSERT(executionContext); | 599 ASSERT(executionContext); |
560 | 600 |
561 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DeleteEntryRequest::didHitError); | 601 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DeleteEntryRequest::didHitError); |
562 | 602 |
563 FileSystemType type; | 603 FileSystemType type; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 return 0; | 765 return 0; |
726 } | 766 } |
727 | 767 |
728 DEFINE_TRACE(InspectorFileSystemAgent) | 768 DEFINE_TRACE(InspectorFileSystemAgent) |
729 { | 769 { |
730 visitor->trace(m_page); | 770 visitor->trace(m_page); |
731 InspectorBaseAgent::trace(visitor); | 771 InspectorBaseAgent::trace(visitor); |
732 } | 772 } |
733 | 773 |
734 } // namespace blink | 774 } // namespace blink |
OLD | NEW |