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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(PassRefPtr<Handler> handler, HandlingMetho
d handlingMethod) |
90 { | 90 { |
91 return new CallbackDispatcher(handler, handlingMethod); | 91 return new CallbackDispatcher(handler, handlingMethod); |
92 } | 92 } |
93 | 93 |
94 virtual 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 private: | 99 private: |
100 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho
d) | 100 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho
d) |
101 : m_handler(handler) | 101 : m_handler(handler) |
102 , m_handlingMethod(handlingMethod) { } | 102 , m_handlingMethod(handlingMethod) { } |
103 | 103 |
104 RefPtr<Handler> m_handler; | 104 RefPtr<Handler> m_handler; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } | 375 } |
376 | 376 |
377 class FileContentRequest final : public EventListener { | 377 class FileContentRequest final : public EventListener { |
378 WTF_MAKE_NONCOPYABLE(FileContentRequest); | 378 WTF_MAKE_NONCOPYABLE(FileContentRequest); |
379 public: | 379 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) | 380 static PassRefPtr<FileContentRequest> create(PassRefPtrWillBeRawPtr<RequestF
ileContentCallback> requestCallback, const String& url, bool readAsText, long lo
ng start, long long end, const String& charset) |
381 { | 381 { |
382 return adoptRef(new FileContentRequest(requestCallback, url, readAsText,
start, end, charset)); | 382 return adoptRef(new FileContentRequest(requestCallback, url, readAsText,
start, end, charset)); |
383 } | 383 } |
384 | 384 |
385 virtual ~FileContentRequest() | 385 ~FileContentRequest() override |
386 { | 386 { |
387 reportResult(FileError::ABORT_ERR); | 387 reportResult(FileError::ABORT_ERR); |
388 } | 388 } |
389 | 389 |
390 void start(ExecutionContext*); | 390 void start(ExecutionContext*); |
391 | 391 |
392 virtual bool operator==(const EventListener& other) override | 392 bool operator==(const EventListener& other) override |
393 { | 393 { |
394 return this == &other; | 394 return this == &other; |
395 } | 395 } |
396 | 396 |
397 virtual void handleEvent(ExecutionContext*, Event* event) override | 397 void handleEvent(ExecutionContext*, Event* event) override |
398 { | 398 { |
399 if (event->type() == EventTypeNames::load) | 399 if (event->type() == EventTypeNames::load) |
400 didRead(); | 400 didRead(); |
401 else if (event->type() == EventTypeNames::error) | 401 else if (event->type() == EventTypeNames::error) |
402 didHitError(m_reader->error()); | 402 didHitError(m_reader->error()); |
403 } | 403 } |
404 | 404 |
405 private: | 405 private: |
406 bool didHitError(FileError* error) | 406 bool didHitError(FileError* error) |
407 { | 407 { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 private: | 517 private: |
518 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods | 518 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods |
519 class VoidCallbackImpl final : public VoidCallback { | 519 class VoidCallbackImpl final : public VoidCallback { |
520 public: | 520 public: |
521 explicit VoidCallbackImpl(PassRefPtr<DeleteEntryRequest> handler) | 521 explicit VoidCallbackImpl(PassRefPtr<DeleteEntryRequest> handler) |
522 : m_handler(handler) | 522 : m_handler(handler) |
523 { | 523 { |
524 } | 524 } |
525 | 525 |
526 virtual void handleEvent() override | 526 void handleEvent() override |
527 { | 527 { |
528 m_handler->didDeleteEntry(); | 528 m_handler->didDeleteEntry(); |
529 } | 529 } |
530 | 530 |
531 private: | 531 private: |
532 RefPtr<DeleteEntryRequest> m_handler; | 532 RefPtr<DeleteEntryRequest> m_handler; |
533 }; | 533 }; |
534 | 534 |
535 bool didHitError(FileError* error) | 535 bool didHitError(FileError* error) |
536 { | 536 { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 return 0; | 725 return 0; |
726 } | 726 } |
727 | 727 |
728 DEFINE_TRACE(InspectorFileSystemAgent) | 728 DEFINE_TRACE(InspectorFileSystemAgent) |
729 { | 729 { |
730 visitor->trace(m_page); | 730 visitor->trace(m_page); |
731 InspectorBaseAgent::trace(visitor); | 731 InspectorBaseAgent::trace(visitor); |
732 } | 732 } |
733 | 733 |
734 } // namespace blink | 734 } // namespace blink |
OLD | NEW |