| 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
|
|
|