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

Unified Diff: third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java

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
Index: third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
similarity index 53%
copy from third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
copy to third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
index a6fa87d7ef65d50525b5d0a8c6a2253477037dbb..2cf210d26f58548e03805eef04114c5c337e85d6 100644
--- a/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
+++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Protocol Buffers - Google's data interchange format
+ * Copyright 2014 Google Inc. All rights reserved.
+ * 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
@@ -27,36 +29,40 @@
* (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 DedicatedWorkerThread_h
-#define DedicatedWorkerThread_h
-#include "core/workers/WorkerThread.h"
+package com.google.protobuf.jruby;
-namespace blink {
+import org.jruby.Ruby;
+import org.jruby.RubyModule;
+import org.jruby.anno.JRubyMethod;
+import org.jruby.anno.JRubyModule;
+import org.jruby.runtime.ThreadContext;
+import org.jruby.runtime.builtin.IRubyObject;
-class InProcessWorkerObjectProxy;
-class WorkerThreadStartupData;
+@JRubyModule(name = "Protobuf")
+public class RubyProtobuf {
-class DedicatedWorkerThread final : public WorkerThread {
-public:
- static PassOwnPtr<DedicatedWorkerThread> create(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin);
- ~DedicatedWorkerThread() override;
+ public static void createProtobuf(Ruby runtime) {
+ RubyModule mGoogle = runtime.getModule("Google");
+ RubyModule mProtobuf = mGoogle.defineModuleUnder("Protobuf");
+ mProtobuf.defineAnnotatedMethods(RubyProtobuf.class);
+ }
- WorkerBackingThread& workerBackingThread() override { return *m_workerBackingThread; }
- InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
-
-protected:
- WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupData>) override;
- void postInitialize() override;
-
-private:
- DedicatedWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectProxy&, double timeOrigin);
-
- OwnPtr<WorkerBackingThread> m_workerBackingThread;
- InProcessWorkerObjectProxy& m_workerObjectProxy;
- double m_timeOrigin;
-};
-
-} // namespace blink
-
-#endif // DedicatedWorkerThread_h
+ /*
+ * call-seq:
+ * Google::Protobuf.deep_copy(obj) => copy_of_obj
+ *
+ * Performs a deep copy of either a RepeatedField instance or a message object,
+ * recursively copying its members.
+ */
+ @JRubyMethod(name = "deep_copy", meta = true)
+ public static IRubyObject deepCopy(ThreadContext context, IRubyObject self, IRubyObject message) {
+ if (message instanceof RubyMessage) {
+ return ((RubyMessage) message).deepCopy(context);
+ } else if (message instanceof RubyRepeatedField) {
+ return ((RubyRepeatedField) message).deepCopy(context);
+ } else {
+ return ((RubyMap) message).deepCopy(context);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698