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

Unified Diff: third_party/grpc/src/compiler/cpp_generator_helpers.h

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/grpc/src/compiler/cpp_generator.cc ('k') | third_party/grpc/src/compiler/cpp_plugin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/grpc/src/compiler/cpp_generator.cc ('k') | third_party/grpc/src/compiler/cpp_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698