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); |
+ } |
+ } |
+} |