| Index: third_party/grpc/include/grpc++/support/slice.h
|
| diff --git a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.h b/third_party/grpc/include/grpc++/support/slice.h
|
| similarity index 52%
|
| copy from third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.h
|
| copy to third_party/grpc/include/grpc++/support/slice.h
|
| index f9aa053125ace63934179373b082b12de04a9bfa..724691a0333994f4d5d11119ae80e25cd0325cab 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.h
|
| +++ b/third_party/grpc/include/grpc++/support/slice.h
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2009 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,56 +28,61 @@
|
| * 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 OpenTypeSanitizer_h
|
| -#define OpenTypeSanitizer_h
|
| +#ifndef GRPCXX_SUPPORT_SLICE_H
|
| +#define GRPCXX_SUPPORT_SLICE_H
|
|
|
| -#include "opentype-sanitiser.h"
|
| -#include "wtf/Allocator.h"
|
| -#include "wtf/Forward.h"
|
| -#include "wtf/text/WTFString.h"
|
| +#include <grpc/support/slice.h>
|
| +#include <grpc++/support/config.h>
|
|
|
| -namespace blink {
|
| +namespace grpc {
|
|
|
| -class SharedBuffer;
|
| +/// A wrapper around \a gpr_slice.
|
| +///
|
| +/// A slice represents a contiguous reference counted array of bytes.
|
| +/// It is cheap to take references to a slice, and it is cheap to create a
|
| +/// slice pointing to a subset of another slice.
|
| +class Slice GRPC_FINAL {
|
| + public:
|
| + /// Construct an empty slice.
|
| + Slice();
|
| + // Destructor - drops one reference.
|
| + ~Slice();
|
|
|
| -class OpenTypeSanitizer {
|
| - STACK_ALLOCATED();
|
| -public:
|
| - explicit OpenTypeSanitizer(SharedBuffer* buffer)
|
| - : m_buffer(buffer)
|
| - , m_otsErrorString("")
|
| - {
|
| - }
|
| + enum AddRef { ADD_REF };
|
| + /// Construct a slice from \a slice, adding a reference.
|
| + Slice(gpr_slice slice, AddRef);
|
|
|
| - PassRefPtr<SharedBuffer> sanitize();
|
| + enum StealRef { STEAL_REF };
|
| + /// Construct a slice from \a slice, stealing a reference.
|
| + Slice(gpr_slice slice, StealRef);
|
|
|
| - static bool supportsFormat(const String&);
|
| - String getErrorString() const { return static_cast<String>(m_otsErrorString); }
|
| + /// Copy constructor, adds a reference.
|
| + Slice(const Slice& other);
|
|
|
| - void setErrorString(const String& errorString) { m_otsErrorString = errorString; }
|
| + /// Assignment, reference count is unchanged.
|
| + Slice& operator=(Slice other) {
|
| + std::swap(slice_, other.slice_);
|
| + return *this;
|
| + }
|
|
|
| -private:
|
| - SharedBuffer* const m_buffer;
|
| - String m_otsErrorString;
|
| -};
|
| + /// Byte size.
|
| + size_t size() const { return GPR_SLICE_LENGTH(slice_); }
|
| +
|
| + /// Raw pointer to the beginning (first element) of the slice.
|
| + const uint8_t* begin() const { return GPR_SLICE_START_PTR(slice_); }
|
| +
|
| + /// Raw pointer to the end (one byte \em past the last element) of the slice.
|
| + const uint8_t* end() const { return GPR_SLICE_END_PTR(slice_); }
|
|
|
| -class BlinkOTSContext: public ots::OTSContext {
|
| - DISALLOW_NEW();
|
| -public:
|
| - BlinkOTSContext()
|
| - : m_errorString("")
|
| - {
|
| - }
|
| + private:
|
| + friend class ByteBuffer;
|
|
|
| - virtual void Message(int level, const char *format, ...);
|
| - virtual ots::TableAction GetTableAction(uint32_t tag);
|
| - String getErrorString() const { return static_cast<String>(m_errorString); }
|
| -private:
|
| - String m_errorString;
|
| + gpr_slice slice_;
|
| };
|
|
|
| -} // namespace blink
|
| +} // namespace grpc
|
|
|
| -#endif // OpenTypeSanitizer_h
|
| +#endif // GRPCXX_SUPPORT_SLICE_H
|
|
|