Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 } | 46 } |
| 47 | 47 |
| 48 namespace IPC { | 48 namespace IPC { |
| 49 class Sender; | 49 class Sender; |
| 50 } | 50 } |
| 51 | 51 |
| 52 #ifdef NDEBUG | 52 #ifdef NDEBUG |
| 53 #define EXTENSION_FUNCTION_VALIDATE(test) \ | 53 #define EXTENSION_FUNCTION_VALIDATE(test) \ |
| 54 do { \ | 54 do { \ |
| 55 if (!(test)) { \ | 55 if (!(test)) { \ |
| 56 bad_message_ = true; \ | 56 this->bad_message_ = true; \ |
|
Ken Rockot(use gerrit already)
2014/09/02 21:16:21
nit: Is this really necessary?
| |
| 57 return ValidationFailure(this); \ | 57 return ValidationFailure(this); \ |
| 58 } \ | 58 } \ |
| 59 } while (0) | 59 } while (0) |
| 60 #else // NDEBUG | 60 #else // NDEBUG |
| 61 #define EXTENSION_FUNCTION_VALIDATE(test) CHECK(test) | 61 #define EXTENSION_FUNCTION_VALIDATE(test) CHECK(test) |
| 62 #endif // NDEBUG | 62 #endif // NDEBUG |
| 63 | 63 |
| 64 #define EXTENSION_FUNCTION_ERROR(error) \ | 64 #define EXTENSION_FUNCTION_ERROR(error) \ |
| 65 do { \ | 65 do { \ |
| 66 error_ = error; \ | 66 error_ = error; \ |
| 67 bad_message_ = true; \ | 67 this->bad_message_ = true; \ |
| 68 return ValidationFailure(this); \ | 68 return ValidationFailure(this); \ |
| 69 } while (0) | 69 } while (0) |
| 70 | 70 |
| 71 // Declares a callable extension function with the given |name|. You must also | 71 // Declares a callable extension function with the given |name|. You must also |
| 72 // supply a unique |histogramvalue| used for histograms of extension function | 72 // supply a unique |histogramvalue| used for histograms of extension function |
| 73 // invocation (add new ones at the end of the enum in | 73 // invocation (add new ones at the end of the enum in |
| 74 // extension_function_histogram_value.h). | 74 // extension_function_histogram_value.h). |
| 75 #define DECLARE_EXTENSION_FUNCTION(name, histogramvalue) \ | 75 #define DECLARE_EXTENSION_FUNCTION(name, histogramvalue) \ |
| 76 public: static const char* function_name() { return name; } \ | 76 public: static const char* function_name() { return name; } \ |
| 77 public: static extensions::functions::HistogramValue histogram_value() \ | 77 public: static extensions::functions::HistogramValue histogram_value() \ |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 virtual bool RunSync() = 0; | 606 virtual bool RunSync() = 0; |
| 607 | 607 |
| 608 // ValidationFailure override to match RunSync(). | 608 // ValidationFailure override to match RunSync(). |
| 609 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); | 609 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); |
| 610 | 610 |
| 611 private: | 611 private: |
| 612 virtual ResponseAction Run() OVERRIDE; | 612 virtual ResponseAction Run() OVERRIDE; |
| 613 }; | 613 }; |
| 614 | 614 |
| 615 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 615 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| OLD | NEW |