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

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

Powered by Google App Engine
This is Rietveld 408576698