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

Unified Diff: third_party/protobuf/js/node_loader.js

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 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/protobuf/js/message_test.js ('k') | third_party/protobuf/js/package.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/protobuf/js/node_loader.js
diff --git a/third_party/protobuf/src/google/protobuf/service.cc b/third_party/protobuf/js/node_loader.js
similarity index 76%
copy from third_party/protobuf/src/google/protobuf/service.cc
copy to third_party/protobuf/js/node_loader.js
index caf968ca5b4d46115c87a504b6a09d1358356884..79211adda49a325ad64d80e1227617bfb9aef5ba 100644
--- a/third_party/protobuf/src/google/protobuf/service.cc
+++ b/third_party/protobuf/js/node_loader.js
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
+// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,19 +28,22 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
+/**
+ * @fileoverview Loader that handles goog.require() for Node.JS.
+ */
-#include <google/protobuf/service.h>
+var oldLoader = goog.global.CLOSURE_IMPORT_SCRIPT;
-namespace google {
-namespace protobuf {
+goog.global.CLOSURE_IMPORT_SCRIPT = function(src, opt_sourceText) {
+ if (opt_sourceText === undefined) {
+ try {
+ // Load from the current directory.
+ require("./" + src);
+ return true;
+ } catch (e) {
+ // Fall back to the Closure loader.
+ }
+ }
-Service::~Service() {}
-RpcChannel::~RpcChannel() {}
-RpcController::~RpcController() {}
-
-} // namespace protobuf
-
-} // namespace google
+ return oldLoader(src, opt_sourceText);
+};
« no previous file with comments | « third_party/protobuf/js/message_test.js ('k') | third_party/protobuf/js/package.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698