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

Side by Side Diff: Source/core/inspector/InspectorFileSystemAgent.cpp

Issue 111603006: Simplify invokeCallback() and support void return values for IDL callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 template<typename BaseCallback, typename Handler, typename Argument> 82 template<typename BaseCallback, typename Handler, typename Argument>
83 class CallbackDispatcher : public BaseCallback { 83 class CallbackDispatcher : public BaseCallback {
84 public: 84 public:
85 typedef bool (Handler::*HandlingMethod)(Argument); 85 typedef bool (Handler::*HandlingMethod)(Argument);
86 86
87 static PassOwnPtr<CallbackDispatcher> create(PassRefPtr<Handler> handler, Ha ndlingMethod handlingMethod) 87 static PassOwnPtr<CallbackDispatcher> create(PassRefPtr<Handler> handler, Ha ndlingMethod handlingMethod)
88 { 88 {
89 return adoptPtr(new CallbackDispatcher(handler, handlingMethod)); 89 return adoptPtr(new CallbackDispatcher(handler, handlingMethod));
90 } 90 }
91 91
92 virtual bool handleEvent(Argument argument) OVERRIDE 92 virtual void handleEvent(Argument argument) OVERRIDE
93 { 93 {
94 return (m_handler.get()->*m_handlingMethod)(argument); 94 (m_handler.get()->*m_handlingMethod)(argument);
95 } 95 }
96 96
97 private: 97 private:
98 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho d) 98 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho d)
99 : m_handler(handler) 99 : m_handler(handler)
100 , m_handlingMethod(handlingMethod) { } 100 , m_handlingMethod(handlingMethod) { }
101 101
102 RefPtr<Handler> m_handler; 102 RefPtr<Handler> m_handler;
103 HandlingMethod m_handlingMethod; 103 HandlingMethod m_handlingMethod;
104 }; 104 };
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 512
513 private: 513 private:
514 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods 514 // CallbackDispatcherFactory doesn't handle 0-arg handleEvent methods
515 class VoidCallbackImpl : public VoidCallback { 515 class VoidCallbackImpl : public VoidCallback {
516 public: 516 public:
517 explicit VoidCallbackImpl(PassRefPtr<DeleteEntryRequest> handler) 517 explicit VoidCallbackImpl(PassRefPtr<DeleteEntryRequest> handler)
518 : m_handler(handler) 518 : m_handler(handler)
519 { 519 {
520 } 520 }
521 521
522 virtual bool handleEvent() OVERRIDE 522 virtual void handleEvent() OVERRIDE
523 { 523 {
524 return m_handler->didDeleteEntry(); 524 m_handler->didDeleteEntry();
525 } 525 }
526 526
527 private: 527 private:
528 RefPtr<DeleteEntryRequest> m_handler; 528 RefPtr<DeleteEntryRequest> m_handler;
529 }; 529 };
530 530
531 bool didHitError(FileError* error) 531 bool didHitError(FileError* error)
532 { 532 {
533 reportResult(error->code()); 533 reportResult(error->code());
534 return true; 534 return true;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree().t raverseNext()) { 720 for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree().t raverseNext()) {
721 if (frame->document() && frame->document()->securityOrigin()->isSameSche meHostPort(origin)) 721 if (frame->document() && frame->document()->securityOrigin()->isSameSche meHostPort(origin))
722 return frame->document(); 722 return frame->document();
723 } 723 }
724 724
725 *error = "No frame is available for the request"; 725 *error = "No frame is available for the request";
726 return 0; 726 return 0;
727 } 727 }
728 728
729 } // namespace WebCore 729 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698