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

Unified Diff: third_party/grpc/src/node/ext/timeval.cc

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/node/ext/timeval.h ('k') | third_party/grpc/src/node/health_check/health.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/grpc/src/node/ext/timeval.cc
diff --git a/third_party/WebKit/public/web/WebDOMMediaStreamTrack.h b/third_party/grpc/src/node/ext/timeval.cc
similarity index 58%
copy from third_party/WebKit/public/web/WebDOMMediaStreamTrack.h
copy to third_party/grpc/src/node/ext/timeval.cc
index bdb742ae05ae37e0ed19a9d7005e1858d6e543f4..c8f8534cfa7fd6abadfe8f1459cd7f9cc7c43f68 100644
--- a/third_party/WebKit/public/web/WebDOMMediaStreamTrack.h
+++ b/third_party/grpc/src/node/ext/timeval.cc
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Copyright 2015-2016, 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,54 +28,41 @@
* 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 WebDOMMediaStreamTrack_h
-#define WebDOMMediaStreamTrack_h
+#include <limits>
+#include <cstdint>
-#include "public/platform/WebMediaStreamTrack.h"
-#include "public/platform/WebPrivatePtr.h"
+#include "grpc/grpc.h"
+#include "grpc/support/time.h"
+#include "timeval.h"
-#if BLINK_IMPLEMENTATION
-#include "wtf/PassRefPtr.h"
-#endif
+namespace grpc {
+namespace node {
-namespace v8 {
-class Value;
-template <class T> class Local;
+gpr_timespec MillisecondsToTimespec(double millis) {
+ if (millis == std::numeric_limits<double>::infinity()) {
+ return gpr_inf_future(GPR_CLOCK_REALTIME);
+ } else if (millis == -std::numeric_limits<double>::infinity()) {
+ return gpr_inf_past(GPR_CLOCK_REALTIME);
+ } else {
+ return gpr_time_from_micros(static_cast<int64_t>(millis * 1000),
+ GPR_CLOCK_REALTIME);
+ }
}
-namespace blink {
-
-class MediaStreamTrack;
-
-class WebDOMMediaStreamTrack {
-public:
- WebDOMMediaStreamTrack(const WebDOMMediaStreamTrack& b) { assign(b); }
- ~WebDOMMediaStreamTrack() { reset(); }
-
- WebDOMMediaStreamTrack& operator=(const WebDOMMediaStreamTrack& b)
- {
- assign(b);
- return *this;
- }
-
- bool isNull() const { return m_private.isNull(); }
-
- BLINK_EXPORT static WebDOMMediaStreamTrack fromV8Value(v8::Local<v8::Value>);
-
- BLINK_EXPORT void reset();
- BLINK_EXPORT void assign(const WebDOMMediaStreamTrack&);
- BLINK_EXPORT WebMediaStreamTrack component() const;
-
-private:
-#if BLINK_IMPLEMENTATION
- WebDOMMediaStreamTrack(MediaStreamTrack*);
-#endif
-
- WebPrivatePtr<MediaStreamTrack> m_private;
-};
-
-} // namespace blink
+double TimespecToMilliseconds(gpr_timespec timespec) {
+ timespec = gpr_convert_clock_type(timespec, GPR_CLOCK_REALTIME);
+ if (gpr_time_cmp(timespec, gpr_inf_future(GPR_CLOCK_REALTIME)) == 0) {
+ return std::numeric_limits<double>::infinity();
+ } else if (gpr_time_cmp(timespec, gpr_inf_past(GPR_CLOCK_REALTIME)) == 0) {
+ return -std::numeric_limits<double>::infinity();
+ } else {
+ return (static_cast<double>(timespec.tv_sec) * 1000 +
+ static_cast<double>(timespec.tv_nsec) / 1000000);
+ }
+}
-#endif
+} // namespace node
+} // namespace grpc
« no previous file with comments | « third_party/grpc/src/node/ext/timeval.h ('k') | third_party/grpc/src/node/health_check/health.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698