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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 GC_PLUGIN_IGNORE("crbug.com/513077") CallbackDispatcher final : public Bas eCallback { 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(PassRefPtrWillBeRawPtr<Handler> handler, H andlingMethod handlingMethod) 89 static CallbackDispatcher* create(RawPtr<Handler> handler, HandlingMethod ha ndlingMethod)
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() 99 DEFINE_INLINE_TRACE()
100 { 100 {
101 visitor->trace(m_handler); 101 visitor->trace(m_handler);
102 BaseCallback::trace(visitor); 102 BaseCallback::trace(visitor);
103 } 103 }
104 104
105 private: 105 private:
106 CallbackDispatcher(PassRefPtrWillBeRawPtr<Handler> handler, HandlingMethod h andlingMethod) 106 CallbackDispatcher(RawPtr<Handler> handler, HandlingMethod handlingMethod)
107 : m_handler(handler) 107 : m_handler(handler)
108 , m_handlingMethod(handlingMethod) { } 108 , m_handlingMethod(handlingMethod) { }
109 109
110 RefPtrWillBeMember<Handler> m_handler; 110 Member<Handler> m_handler;
111 HandlingMethod m_handlingMethod; 111 HandlingMethod m_handlingMethod;
112 }; 112 };
113 113
114 template<typename BaseCallback> 114 template<typename BaseCallback>
115 class CallbackDispatcherFactory { 115 class CallbackDispatcherFactory {
116 public: 116 public:
117 template<typename Handler, typename Argument> 117 template<typename Handler, typename Argument>
118 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))
119 { 119 {
120 return CallbackDispatcher<BaseCallback, Handler, Argument>::create(PassR efPtrWillBeRawPtr<Handler>(handler), handlingMethod); 120 return CallbackDispatcher<BaseCallback, Handler, Argument>::create(RawPt r<Handler>(handler), handlingMethod);
121 } 121 }
122 }; 122 };
123 123
124 class FileSystemRootRequest final : public RefCountedWillBeGarbageCollectedFinal ized<FileSystemRootRequest> { 124 class FileSystemRootRequest final : public GarbageCollectedFinalized<FileSystemR ootRequest> {
125 WTF_MAKE_NONCOPYABLE(FileSystemRootRequest); 125 WTF_MAKE_NONCOPYABLE(FileSystemRootRequest);
126 public: 126 public:
127 static PassRefPtrWillBeRawPtr<FileSystemRootRequest> create(PassRefPtr<Reque stFileSystemRootCallback> requestCallback, const String& type) 127 static RawPtr<FileSystemRootRequest> create(PassRefPtr<RequestFileSystemRoot Callback> requestCallback, const String& type)
128 { 128 {
129 return adoptRefWillBeNoop(new FileSystemRootRequest(requestCallback, typ e)); 129 return (new FileSystemRootRequest(requestCallback, type));
130 } 130 }
131 131
132 void start(ExecutionContext*); 132 void start(ExecutionContext*);
133 133
134 DEFINE_INLINE_TRACE() 134 DEFINE_INLINE_TRACE()
135 { 135 {
136 } 136 }
137 137
138 private: 138 private:
139 bool didHitError(FileError* error) 139 bool didHitError(FileError* error)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 bool FileSystemRootRequest::didGetEntry(Entry* entry) 183 bool FileSystemRootRequest::didGetEntry(Entry* entry)
184 { 184 {
185 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent ry::create() 185 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent ry::create()
186 .setUrl(entry->toURL()) 186 .setUrl(entry->toURL())
187 .setName("/") 187 .setName("/")
188 .setIsDirectory(true); 188 .setIsDirectory(true);
189 reportResult(static_cast<FileError::ErrorCode>(0), result); 189 reportResult(static_cast<FileError::ErrorCode>(0), result);
190 return true; 190 return true;
191 } 191 }
192 192
193 class DirectoryContentRequest final : public RefCountedWillBeGarbageCollectedFin alized<DirectoryContentRequest> { 193 class DirectoryContentRequest final : public GarbageCollectedFinalized<Directory ContentRequest> {
194 WTF_MAKE_NONCOPYABLE(DirectoryContentRequest); 194 WTF_MAKE_NONCOPYABLE(DirectoryContentRequest);
195 public: 195 public:
196 static PassRefPtrWillBeRawPtr<DirectoryContentRequest> create(PassRefPtr<Req uestDirectoryContentCallback> requestCallback, const String& url) 196 static RawPtr<DirectoryContentRequest> create(PassRefPtr<RequestDirectoryCon tentCallback> requestCallback, const String& url)
197 { 197 {
198 return adoptRefWillBeNoop(new DirectoryContentRequest(requestCallback, u rl)); 198 return (new DirectoryContentRequest(requestCallback, url));
199 } 199 }
200 200
201 ~DirectoryContentRequest() 201 ~DirectoryContentRequest()
202 { 202 {
203 } 203 }
204 204
205 void start(ExecutionContext*); 205 void start(ExecutionContext*);
206 206
207 DEFINE_INLINE_VIRTUAL_TRACE() 207 DEFINE_INLINE_VIRTUAL_TRACE()
208 { 208 {
(...skipping 17 matching lines...) Expand all
226 226
227 DirectoryContentRequest(PassRefPtr<RequestDirectoryContentCallback> requestC allback, const String& url) 227 DirectoryContentRequest(PassRefPtr<RequestDirectoryContentCallback> requestC allback, const String& url)
228 : m_requestCallback(requestCallback) 228 : m_requestCallback(requestCallback)
229 , m_url(ParsedURLString, url) { } 229 , m_url(ParsedURLString, url) { }
230 230
231 void readDirectoryEntries(); 231 void readDirectoryEntries();
232 232
233 RefPtr<RequestDirectoryContentCallback> m_requestCallback; 233 RefPtr<RequestDirectoryContentCallback> m_requestCallback;
234 KURL m_url; 234 KURL m_url;
235 RefPtr<Array<TypeBuilder::FileSystem::Entry>> m_entries; 235 RefPtr<Array<TypeBuilder::FileSystem::Entry>> m_entries;
236 PersistentWillBeMember<DirectoryReader> m_directoryReader; 236 Member<DirectoryReader> m_directoryReader;
237 }; 237 };
238 238
239 void DirectoryContentRequest::start(ExecutionContext* executionContext) 239 void DirectoryContentRequest::start(ExecutionContext* executionContext)
240 { 240 {
241 ASSERT(executionContext); 241 ASSERT(executionContext);
242 242
243 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DirectoryContentRequest::didHitError); 243 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &DirectoryContentRequest::didHitError);
244 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &DirectoryContentRequest::didGetEntry); 244 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &DirectoryContentRequest::didGetEntry);
245 245
246 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); 246 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 entryForFrontend->setMimeType(mimeType); 311 entryForFrontend->setMimeType(mimeType);
312 entryForFrontend->setResourceType(resourceType); 312 entryForFrontend->setResourceType(resourceType);
313 } 313 }
314 314
315 m_entries->addItem(entryForFrontend); 315 m_entries->addItem(entryForFrontend);
316 } 316 }
317 readDirectoryEntries(); 317 readDirectoryEntries();
318 return true; 318 return true;
319 } 319 }
320 320
321 class MetadataRequest final : public RefCountedWillBeGarbageCollectedFinalized<M etadataRequest> { 321 class MetadataRequest final : public GarbageCollectedFinalized<MetadataRequest> {
322 WTF_MAKE_NONCOPYABLE(MetadataRequest); 322 WTF_MAKE_NONCOPYABLE(MetadataRequest);
323 public: 323 public:
324 static PassRefPtrWillBeRawPtr<MetadataRequest> create(PassRefPtr<RequestMeta dataCallback> requestCallback, const String& url) 324 static RawPtr<MetadataRequest> create(PassRefPtr<RequestMetadataCallback> re questCallback, const String& url)
325 { 325 {
326 return adoptRefWillBeNoop(new MetadataRequest(requestCallback, url)); 326 return (new MetadataRequest(requestCallback, url));
327 } 327 }
328 328
329 ~MetadataRequest() 329 ~MetadataRequest()
330 { 330 {
331 } 331 }
332 332
333 void start(ExecutionContext*); 333 void start(ExecutionContext*);
334 334
335 DEFINE_INLINE_VIRTUAL_TRACE() 335 DEFINE_INLINE_VIRTUAL_TRACE()
336 { 336 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 RefPtr<Metadata> result = Metadata::create() 390 RefPtr<Metadata> result = Metadata::create()
391 .setModificationTime(metadata->modificationTime()) 391 .setModificationTime(metadata->modificationTime())
392 .setSize(metadata->size()); 392 .setSize(metadata->size());
393 reportResult(static_cast<FileError::ErrorCode>(0), result); 393 reportResult(static_cast<FileError::ErrorCode>(0), result);
394 return true; 394 return true;
395 } 395 }
396 396
397 class FileContentRequest final : public EventListener { 397 class FileContentRequest final : public EventListener {
398 WTF_MAKE_NONCOPYABLE(FileContentRequest); 398 WTF_MAKE_NONCOPYABLE(FileContentRequest);
399 public: 399 public:
400 static PassRefPtrWillBeRawPtr<FileContentRequest> create(PassRefPtr<RequestF ileContentCallback> requestCallback, const String& url, bool readAsText, long lo ng start, long long end, const String& charset) 400 static RawPtr<FileContentRequest> create(PassRefPtr<RequestFileContentCallba ck> requestCallback, const String& url, bool readAsText, long long start, long l ong end, const String& charset)
401 { 401 {
402 return adoptRefWillBeNoop(new FileContentRequest(requestCallback, url, r eadAsText, start, end, charset)); 402 return (new FileContentRequest(requestCallback, url, readAsText, start, end, charset));
403 } 403 }
404 404
405 ~FileContentRequest() override 405 ~FileContentRequest() override
406 { 406 {
407 } 407 }
408 408
409 void start(ExecutionContext*); 409 void start(ExecutionContext*);
410 410
411 bool operator==(const EventListener& other) const override 411 bool operator==(const EventListener& other) const override
412 { 412 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 , m_charset(charset) { } 453 , m_charset(charset) { }
454 454
455 RefPtr<RequestFileContentCallback> m_requestCallback; 455 RefPtr<RequestFileContentCallback> m_requestCallback;
456 KURL m_url; 456 KURL m_url;
457 bool m_readAsText; 457 bool m_readAsText;
458 int m_start; 458 int m_start;
459 long long m_end; 459 long long m_end;
460 String m_mimeType; 460 String m_mimeType;
461 String m_charset; 461 String m_charset;
462 462
463 PersistentWillBeMember<FileReader> m_reader; 463 Member<FileReader> m_reader;
464 }; 464 };
465 465
466 void FileContentRequest::start(ExecutionContext* executionContext) 466 void FileContentRequest::start(ExecutionContext* executionContext)
467 { 467 {
468 ASSERT(executionContext); 468 ASSERT(executionContext);
469 469
470 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileContentRequest::didHitError); 470 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre ate(this, &FileContentRequest::didHitError);
471 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &FileContentRequest::didGetEntry); 471 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c reate(this, &FileContentRequest::didGetEntry);
472 472
473 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext); 473 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback, errorCallback, executionContext);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return; 518 return;
519 } 519 }
520 520
521 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType , m_charset, true); 521 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType , m_charset, true);
522 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer-> byteLength()); 522 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer-> byteLength());
523 result = result + decoder->flush(); 523 result = result + decoder->flush();
524 m_charset = decoder->encoding().name(); 524 m_charset = decoder->encoding().name();
525 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset); 525 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset);
526 } 526 }
527 527
528 class DeleteEntryRequest final : public RefCountedWillBeGarbageCollectedFinalize d<DeleteEntryRequest> { 528 class DeleteEntryRequest final : public GarbageCollectedFinalized<DeleteEntryReq uest> {
529 public: 529 public:
530 static PassRefPtrWillBeRawPtr<DeleteEntryRequest> create(PassRefPtr<DeleteEn tryCallback> requestCallback, const KURL& url) 530 static RawPtr<DeleteEntryRequest> create(PassRefPtr<DeleteEntryCallback> req uestCallback, const KURL& url)
531 { 531 {
532 return adoptRefWillBeNoop(new DeleteEntryRequest(requestCallback, url)); 532 return (new DeleteEntryRequest(requestCallback, url));
533 } 533 }
534 534
535 ~DeleteEntryRequest() 535 ~DeleteEntryRequest()
536 { 536 {
537 } 537 }
538 538
539 void start(ExecutionContext*); 539 void start(ExecutionContext*);
540 540
541 DEFINE_INLINE_TRACE() 541 DEFINE_INLINE_TRACE()
542 { 542 {
543 } 543 }
544 544
545 private: 545 private:
546 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods 546 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods
547 class VoidCallbackImpl final : public VoidCallback { 547 class VoidCallbackImpl final : public VoidCallback {
548 public: 548 public:
549 explicit VoidCallbackImpl(PassRefPtrWillBeRawPtr<DeleteEntryRequest> han dler) 549 explicit VoidCallbackImpl(RawPtr<DeleteEntryRequest> handler)
550 : m_handler(handler) 550 : m_handler(handler)
551 { 551 {
552 } 552 }
553 553
554 void handleEvent() override 554 void handleEvent() override
555 { 555 {
556 m_handler->didDeleteEntry(); 556 m_handler->didDeleteEntry();
557 } 557 }
558 558
559 DEFINE_INLINE_VIRTUAL_TRACE() 559 DEFINE_INLINE_VIRTUAL_TRACE()
560 { 560 {
561 visitor->trace(m_handler); 561 visitor->trace(m_handler);
562 VoidCallback::trace(visitor); 562 VoidCallback::trace(visitor);
563 } 563 }
564 564
565 private: 565 private:
566 RefPtrWillBeMember<DeleteEntryRequest> m_handler; 566 Member<DeleteEntryRequest> m_handler;
567 }; 567 };
568 568
569 bool didHitError(FileError* error) 569 bool didHitError(FileError* error)
570 { 570 {
571 reportResult(error->code()); 571 reportResult(error->code());
572 return true; 572 return true;
573 } 573 }
574 574
575 bool didGetEntry(Entry*); 575 bool didGetEntry(Entry*);
576 bool didDeleteEntry(); 576 bool didDeleteEntry();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 bool DeleteEntryRequest::didDeleteEntry() 628 bool DeleteEntryRequest::didDeleteEntry()
629 { 629 {
630 reportResult(static_cast<FileError::ErrorCode>(0)); 630 reportResult(static_cast<FileError::ErrorCode>(0));
631 return true; 631 return true;
632 } 632 }
633 633
634 } // anonymous namespace 634 } // anonymous namespace
635 635
636 // static 636 // static
637 PassOwnPtrWillBeRawPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::creat e(InspectedFrames* inspectedFrames) 637 RawPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::create(InspectedFrame s* inspectedFrames)
638 { 638 {
639 return adoptPtrWillBeNoop(new InspectorFileSystemAgent(inspectedFrames)); 639 return (new InspectorFileSystemAgent(inspectedFrames));
640 } 640 }
641 641
642 InspectorFileSystemAgent::~InspectorFileSystemAgent() 642 InspectorFileSystemAgent::~InspectorFileSystemAgent()
643 { 643 {
644 } 644 }
645 645
646 void InspectorFileSystemAgent::enable(ErrorString*) 646 void InspectorFileSystemAgent::enable(ErrorString*)
647 { 647 {
648 if (m_enabled) 648 if (m_enabled)
649 return; 649 return;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return 0; 756 return 0;
757 } 757 }
758 758
759 DEFINE_TRACE(InspectorFileSystemAgent) 759 DEFINE_TRACE(InspectorFileSystemAgent)
760 { 760 {
761 visitor->trace(m_inspectedFrames); 761 visitor->trace(m_inspectedFrames);
762 InspectorBaseAgent::trace(visitor); 762 InspectorBaseAgent::trace(visitor);
763 } 763 }
764 764
765 } // namespace blink 765 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698