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

Side by Side Diff: Source/modules/filesystem/InspectorFileSystemAgent.cpp

Issue 1238083002: Oilpan: Move the EventListener hierarchy to Oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 namespace blink { 76 namespace blink {
77 77
78 namespace FileSystemAgentState { 78 namespace FileSystemAgentState {
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 GC_PLUGIN_IGNORE("crbug.com/513077") CallbackDispatcher final : public Bas eCallback {
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_TRACE()
100 {
101 visitor->trace(m_handler);
102 BaseCallback::trace(visitor);
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
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 } 204 }
194 205
195 void start(ExecutionContext*); 206 void start(ExecutionContext*);
196 207
208 DEFINE_INLINE_VIRTUAL_TRACE()
209 {
210 visitor->trace(m_requestCallback);
211 visitor->trace(m_directoryReader);
212 }
213
197 private: 214 private:
198 bool didHitError(FileError* error) 215 bool didHitError(FileError* error)
199 { 216 {
200 reportResult(error->code()); 217 reportResult(error->code());
201 return true; 218 return true;
202 } 219 }
203 220
204 bool didGetEntry(Entry*); 221 bool didGetEntry(Entry*);
205 bool didReadDirectoryEntries(const EntryHeapVector&); 222 bool didReadDirectoryEntries(const EntryHeapVector&);
206 223
207 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<Array<TypeBuild er::FileSystem::Entry>> entries = nullptr) 224 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<Array<TypeBuild er::FileSystem::Entry>> entries = nullptr)
208 { 225 {
209 m_requestCallback->sendSuccess(static_cast<int>(errorCode), entries); 226 m_requestCallback->sendSuccess(static_cast<int>(errorCode), entries);
210 } 227 }
211 228
212 DirectoryContentRequest(PassRefPtrWillBeRawPtr<RequestDirectoryContentCallba ck> requestCallback, const String& url) 229 DirectoryContentRequest(PassRefPtrWillBeRawPtr<RequestDirectoryContentCallba ck> requestCallback, const String& url)
213 : m_requestCallback(requestCallback) 230 : m_requestCallback(requestCallback)
214 , m_url(ParsedURLString, url) { } 231 , m_url(ParsedURLString, url) { }
215 232
216 void readDirectoryEntries(); 233 void readDirectoryEntries();
217 234
218 RefPtrWillBePersistent<RequestDirectoryContentCallback> m_requestCallback; 235 RefPtrWillBeMember<RequestDirectoryContentCallback> m_requestCallback;
219 KURL m_url; 236 KURL m_url;
220 RefPtr<Array<TypeBuilder::FileSystem::Entry>> m_entries; 237 RefPtr<Array<TypeBuilder::FileSystem::Entry>> m_entries;
221 Persistent<DirectoryReader> m_directoryReader; 238 PersistentWillBeMember<DirectoryReader> m_directoryReader;
222 }; 239 };
223 240
224 void DirectoryContentRequest::start(ExecutionContext* executionContext) 241 void DirectoryContentRequest::start(ExecutionContext* executionContext)
225 { 242 {
226 ASSERT(executionContext); 243 ASSERT(executionContext);
227 244
228 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DirectoryContentRequest::didHitError); 245 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DirectoryContentRequest::didHitError);
229 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &DirectoryContentRequest::didGetEntry); 246 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &DirectoryContentRequest::didGetEntry);
230 247
231 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); 248 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 entryForFrontend->setMimeType(mimeType); 310 entryForFrontend->setMimeType(mimeType);
294 entryForFrontend->setResourceType(resourceType); 311 entryForFrontend->setResourceType(resourceType);
295 } 312 }
296 313
297 m_entries->addItem(entryForFrontend); 314 m_entries->addItem(entryForFrontend);
298 } 315 }
299 readDirectoryEntries(); 316 readDirectoryEntries();
300 return true; 317 return true;
301 } 318 }
302 319
303 class MetadataRequest final : public RefCounted<MetadataRequest> { 320 class MetadataRequest final : public RefCountedWillBeGarbageCollectedFinalized<M etadataRequest> {
304 WTF_MAKE_NONCOPYABLE(MetadataRequest); 321 WTF_MAKE_NONCOPYABLE(MetadataRequest);
305 public: 322 public:
306 static PassRefPtr<MetadataRequest> create(PassRefPtrWillBeRawPtr<RequestMeta dataCallback> requestCallback, const String& url) 323 static PassRefPtrWillBeRawPtr<MetadataRequest> create(PassRefPtrWillBeRawPtr <RequestMetadataCallback> requestCallback, const String& url)
307 { 324 {
308 return adoptRef(new MetadataRequest(requestCallback, url)); 325 return adoptRefWillBeNoop(new MetadataRequest(requestCallback, url));
309 } 326 }
310 327
311 ~MetadataRequest() 328 ~MetadataRequest()
312 { 329 {
313 } 330 }
314 331
315 void start(ExecutionContext*); 332 void start(ExecutionContext*);
316 333
334 DEFINE_INLINE_VIRTUAL_TRACE()
335 {
336 visitor->trace(m_requestCallback);
337 }
338
317 private: 339 private:
318 bool didHitError(FileError* error) 340 bool didHitError(FileError* error)
319 { 341 {
320 reportResult(error->code()); 342 reportResult(error->code());
321 return true; 343 return true;
322 } 344 }
323 345
324 bool didGetEntry(Entry*); 346 bool didGetEntry(Entry*);
325 bool didGetMetadata(Metadata*); 347 bool didGetMetadata(Metadata*);
326 348
327 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::Fi leSystem::Metadata> metadata = nullptr) 349 void reportResult(FileError::ErrorCode errorCode, PassRefPtr<TypeBuilder::Fi leSystem::Metadata> metadata = nullptr)
328 { 350 {
329 m_requestCallback->sendSuccess(static_cast<int>(errorCode), metadata); 351 m_requestCallback->sendSuccess(static_cast<int>(errorCode), metadata);
330 } 352 }
331 353
332 MetadataRequest(PassRefPtrWillBeRawPtr<RequestMetadataCallback> requestCallb ack, const String& url) 354 MetadataRequest(PassRefPtrWillBeRawPtr<RequestMetadataCallback> requestCallb ack, const String& url)
333 : m_requestCallback(requestCallback) 355 : m_requestCallback(requestCallback)
334 , m_url(ParsedURLString, url) { } 356 , m_url(ParsedURLString, url) { }
335 357
336 RefPtrWillBePersistent<RequestMetadataCallback> m_requestCallback; 358 RefPtrWillBeMember<RequestMetadataCallback> m_requestCallback;
337 KURL m_url; 359 KURL m_url;
338 bool m_isDirectory; 360 bool m_isDirectory;
339 }; 361 };
340 362
341 void MetadataRequest::start(ExecutionContext* executionContext) 363 void MetadataRequest::start(ExecutionContext* executionContext)
342 { 364 {
343 ASSERT(executionContext); 365 ASSERT(executionContext);
344 366
345 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &MetadataRequest::didHitError); 367 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &MetadataRequest::didHitError);
346 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &MetadataRequest::didGetEntry); 368 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &MetadataRequest::didGetEntry);
(...skipping 21 matching lines...) Expand all
368 RefPtr<Metadata> result = Metadata::create() 390 RefPtr<Metadata> result = Metadata::create()
369 .setModificationTime(metadata->modificationTime()) 391 .setModificationTime(metadata->modificationTime())
370 .setSize(metadata->size()); 392 .setSize(metadata->size());
371 reportResult(static_cast<FileError::ErrorCode>(0), result); 393 reportResult(static_cast<FileError::ErrorCode>(0), result);
372 return true; 394 return true;
373 } 395 }
374 396
375 class FileContentRequest final : public EventListener { 397 class FileContentRequest final : public EventListener {
376 WTF_MAKE_NONCOPYABLE(FileContentRequest); 398 WTF_MAKE_NONCOPYABLE(FileContentRequest);
377 public: 399 public:
378 static PassRefPtr<FileContentRequest> create(PassRefPtrWillBeRawPtr<RequestF ileContentCallback> requestCallback, const String& url, bool readAsText, long lo ng start, long long end, const String& charset) 400 static PassRefPtrWillBeRawPtr<FileContentRequest> create(PassRefPtrWillBeRaw Ptr<RequestFileContentCallback> requestCallback, const String& url, bool readAsT ext, long long start, long long end, const String& charset)
379 { 401 {
380 return adoptRef(new FileContentRequest(requestCallback, url, readAsText, start, end, charset)); 402 return adoptRefWillBeNoop(new FileContentRequest(requestCallback, url, r eadAsText, start, end, charset));
381 } 403 }
382 404
383 ~FileContentRequest() override 405 ~FileContentRequest() override
384 { 406 {
385 } 407 }
386 408
387 void start(ExecutionContext*); 409 void start(ExecutionContext*);
388 410
389 bool operator==(const EventListener& other) override 411 bool operator==(const EventListener& other) override
390 { 412 {
391 return this == &other; 413 return this == &other;
392 } 414 }
393 415
394 void handleEvent(ExecutionContext*, Event* event) override 416 void handleEvent(ExecutionContext*, Event* event) override
395 { 417 {
396 if (event->type() == EventTypeNames::load) 418 if (event->type() == EventTypeNames::load)
397 didRead(); 419 didRead();
398 else if (event->type() == EventTypeNames::error) 420 else if (event->type() == EventTypeNames::error)
399 didHitError(m_reader->error()); 421 didHitError(m_reader->error());
400 } 422 }
401 423
424 DEFINE_INLINE_VIRTUAL_TRACE()
425 {
426 visitor->trace(m_requestCallback);
427 visitor->trace(m_reader);
428 EventListener::trace(visitor);
429 }
430
402 private: 431 private:
403 bool didHitError(FileError* error) 432 bool didHitError(FileError* error)
404 { 433 {
405 reportResult(error->code()); 434 reportResult(error->code());
406 return true; 435 return true;
407 } 436 }
408 437
409 bool didGetEntry(Entry*); 438 bool didGetEntry(Entry*);
410 bool didGetFile(File*); 439 bool didGetFile(File*);
411 void didRead(); 440 void didRead();
412 441
413 void reportResult(FileError::ErrorCode errorCode, const String* result = 0, const String* charset = 0) 442 void reportResult(FileError::ErrorCode errorCode, const String* result = 0, const String* charset = 0)
414 { 443 {
415 m_requestCallback->sendSuccess(static_cast<int>(errorCode), result, char set); 444 m_requestCallback->sendSuccess(static_cast<int>(errorCode), result, char set);
416 } 445 }
417 446
418 FileContentRequest(PassRefPtrWillBeRawPtr<RequestFileContentCallback> reques tCallback, const String& url, bool readAsText, long long start, long long end, c onst String& charset) 447 FileContentRequest(PassRefPtrWillBeRawPtr<RequestFileContentCallback> reques tCallback, const String& url, bool readAsText, long long start, long long end, c onst String& charset)
419 : EventListener(EventListener::CPPEventListenerType) 448 : EventListener(EventListener::CPPEventListenerType)
420 , m_requestCallback(requestCallback) 449 , m_requestCallback(requestCallback)
421 , m_url(ParsedURLString, url) 450 , m_url(ParsedURLString, url)
422 , m_readAsText(readAsText) 451 , m_readAsText(readAsText)
423 , m_start(start) 452 , m_start(start)
424 , m_end(end) 453 , m_end(end)
425 , m_charset(charset) { } 454 , m_charset(charset) { }
426 455
427 RefPtrWillBePersistent<RequestFileContentCallback> m_requestCallback; 456 RefPtrWillBeMember<RequestFileContentCallback> m_requestCallback;
428 KURL m_url; 457 KURL m_url;
429 bool m_readAsText; 458 bool m_readAsText;
430 int m_start; 459 int m_start;
431 long long m_end; 460 long long m_end;
432 String m_mimeType; 461 String m_mimeType;
433 String m_charset; 462 String m_charset;
434 463
435 Persistent<FileReader> m_reader; 464 PersistentWillBeMember<FileReader> m_reader;
436 }; 465 };
437 466
438 void FileContentRequest::start(ExecutionContext* executionContext) 467 void FileContentRequest::start(ExecutionContext* executionContext)
439 { 468 {
440 ASSERT(executionContext); 469 ASSERT(executionContext);
441 470
442 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileContentRequest::didHitError); 471 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileContentRequest::didHitError);
443 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &FileContentRequest::didGetEntry); 472 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &FileContentRequest::didGetEntry);
444 473
445 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); 474 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 return; 519 return;
491 } 520 }
492 521
493 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType , m_charset, true); 522 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType , m_charset, true);
494 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer-> byteLength()); 523 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer-> byteLength());
495 result = result + decoder->flush(); 524 result = result + decoder->flush();
496 m_charset = decoder->encoding().name(); 525 m_charset = decoder->encoding().name();
497 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset); 526 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset);
498 } 527 }
499 528
500 class DeleteEntryRequest final : public RefCounted<DeleteEntryRequest> { 529 class DeleteEntryRequest final : public RefCountedWillBeGarbageCollectedFinalize d<DeleteEntryRequest> {
501 public: 530 public:
502 static PassRefPtr<DeleteEntryRequest> create(PassRefPtrWillBeRawPtr<DeleteEn tryCallback> requestCallback, const KURL& url) 531 static PassRefPtrWillBeRawPtr<DeleteEntryRequest> create(PassRefPtrWillBeRaw Ptr<DeleteEntryCallback> requestCallback, const KURL& url)
503 { 532 {
504 return adoptRef(new DeleteEntryRequest(requestCallback, url)); 533 return adoptRefWillBeNoop(new DeleteEntryRequest(requestCallback, url));
505 } 534 }
506 535
507 ~DeleteEntryRequest() 536 ~DeleteEntryRequest()
508 { 537 {
509 } 538 }
510 539
511 void start(ExecutionContext*); 540 void start(ExecutionContext*);
512 541
542 DEFINE_INLINE_TRACE()
543 {
544 visitor->trace(m_requestCallback);
545 }
546
513 private: 547 private:
514 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods 548 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods
515 class VoidCallbackImpl final : public VoidCallback { 549 class VoidCallbackImpl final : public VoidCallback {
516 public: 550 public:
517 explicit VoidCallbackImpl(PassRefPtr<DeleteEntryRequest> handler) 551 explicit VoidCallbackImpl(PassRefPtrWillBeRawPtr<DeleteEntryRequest> han dler)
518 : m_handler(handler) 552 : m_handler(handler)
519 { 553 {
520 } 554 }
521 555
522 void handleEvent() override 556 void handleEvent() override
523 { 557 {
524 m_handler->didDeleteEntry(); 558 m_handler->didDeleteEntry();
525 } 559 }
526 560
561 DEFINE_INLINE_VIRTUAL_TRACE()
562 {
563 visitor->trace(m_handler);
564 VoidCallback::trace(visitor);
565 }
566
527 private: 567 private:
528 RefPtr<DeleteEntryRequest> m_handler; 568 RefPtrWillBeMember<DeleteEntryRequest> m_handler;
529 }; 569 };
530 570
531 bool didHitError(FileError* error) 571 bool didHitError(FileError* error)
532 { 572 {
533 reportResult(error->code()); 573 reportResult(error->code());
534 return true; 574 return true;
535 } 575 }
536 576
537 bool didGetEntry(Entry*); 577 bool didGetEntry(Entry*);
538 bool didDeleteEntry(); 578 bool didDeleteEntry();
539 579
540 void reportResult(FileError::ErrorCode errorCode) 580 void reportResult(FileError::ErrorCode errorCode)
541 { 581 {
542 m_requestCallback->sendSuccess(static_cast<int>(errorCode)); 582 m_requestCallback->sendSuccess(static_cast<int>(errorCode));
543 } 583 }
544 584
545 DeleteEntryRequest(PassRefPtrWillBeRawPtr<DeleteEntryCallback> requestCallba ck, const KURL& url) 585 DeleteEntryRequest(PassRefPtrWillBeRawPtr<DeleteEntryCallback> requestCallba ck, const KURL& url)
546 : m_requestCallback(requestCallback) 586 : m_requestCallback(requestCallback)
547 , m_url(url) { } 587 , m_url(url) { }
548 588
549 RefPtrWillBePersistent<DeleteEntryCallback> m_requestCallback; 589 RefPtrWillBeMember<DeleteEntryCallback> m_requestCallback;
550 KURL m_url; 590 KURL m_url;
551 }; 591 };
552 592
553 void DeleteEntryRequest::start(ExecutionContext* executionContext) 593 void DeleteEntryRequest::start(ExecutionContext* executionContext)
554 { 594 {
555 ASSERT(executionContext); 595 ASSERT(executionContext);
556 596
557 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DeleteEntryRequest::didHitError); 597 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DeleteEntryRequest::didHitError);
558 598
559 FileSystemType type; 599 FileSystemType type;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 return 0; 761 return 0;
722 } 762 }
723 763
724 DEFINE_TRACE(InspectorFileSystemAgent) 764 DEFINE_TRACE(InspectorFileSystemAgent)
725 { 765 {
726 visitor->trace(m_page); 766 visitor->trace(m_page);
727 InspectorBaseAgent::trace(visitor); 767 InspectorBaseAgent::trace(visitor);
728 } 768 }
729 769
730 } // namespace blink 770 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698