Index: third_party/grpc/src/compiler/cpp_generator_helpers.h |
diff --git a/third_party/WebKit/Source/modules/quota/StorageQuotaClient.h b/third_party/grpc/src/compiler/cpp_generator_helpers.h |
similarity index 56% |
copy from third_party/WebKit/Source/modules/quota/StorageQuotaClient.h |
copy to third_party/grpc/src/compiler/cpp_generator_helpers.h |
index 1ba82bedc035108083409969a87728ada48d7f89..be68cbe695aeeba496b04dd182a50b35c5d8055f 100644 |
--- a/third_party/WebKit/Source/modules/quota/StorageQuotaClient.h |
+++ b/third_party/grpc/src/compiler/cpp_generator_helpers.h |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2014 Google Inc. All rights reserved. |
+ * |
+ * Copyright 2015, Google Inc. |
+ * All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -26,42 +28,43 @@ |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ * |
*/ |
-#ifndef StorageQuotaClient_h |
-#define StorageQuotaClient_h |
+#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H |
+#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H |
-#include "core/page/Page.h" |
-#include "modules/ModulesExport.h" |
-#include "platform/Supplementable.h" |
-#include "platform/heap/Handle.h" |
-#include "public/platform/WebStorageQuotaType.h" |
-#include "wtf/Forward.h" |
+#include <map> |
+#include "src/compiler/config.h" |
+#include "src/compiler/generator_helpers.h" |
-namespace blink { |
+namespace grpc_cpp_generator { |
-class ExecutionContext; |
-class Page; |
-class ScriptPromise; |
-class ScriptState; |
-class StorageErrorCallback; |
-class StorageQuotaCallback; |
+inline grpc::string DotsToColons(const grpc::string &name) { |
+ return grpc_generator::StringReplace(name, ".", "::"); |
+} |
-class StorageQuotaClient : public Supplement<Page> { |
- WTF_MAKE_NONCOPYABLE(StorageQuotaClient); |
-public: |
- StorageQuotaClient() { } |
- virtual ~StorageQuotaClient() { } |
+inline grpc::string DotsToUnderscores(const grpc::string &name) { |
+ return grpc_generator::StringReplace(name, ".", "_"); |
+} |
- virtual void requestQuota(ExecutionContext*, WebStorageQuotaType, unsigned long long newQuotaInBytes, StorageQuotaCallback*, StorageErrorCallback*) = 0; |
- virtual ScriptPromise requestPersistentQuota(ScriptState*, unsigned long long newQuotaInBytes) = 0; |
+inline grpc::string ClassName(const grpc::protobuf::Descriptor *descriptor, |
+ bool qualified) { |
+ // Find "outer", the descriptor of the top-level message in which |
+ // "descriptor" is embedded. |
+ const grpc::protobuf::Descriptor *outer = descriptor; |
+ while (outer->containing_type() != NULL) outer = outer->containing_type(); |
- static const char* supplementName(); |
- static StorageQuotaClient* from(ExecutionContext*); |
-}; |
+ const grpc::string &outer_name = outer->full_name(); |
+ grpc::string inner_name = descriptor->full_name().substr(outer_name.size()); |
-MODULES_EXPORT void provideStorageQuotaClientTo(Page&, StorageQuotaClient*); |
+ if (qualified) { |
+ return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name); |
+ } else { |
+ return outer->name() + DotsToUnderscores(inner_name); |
+ } |
+} |
-} // namespace blink |
+} // namespace grpc_cpp_generator |
-#endif // StorageQuotaClient_h |
+#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H |