Index: third_party/WebKit/public/platform/WebStringUTF8Adaptor.h |
diff --git a/third_party/WebKit/public/platform/WebRTCVoidRequest.h b/third_party/WebKit/public/platform/WebStringUTF8Adaptor.h |
similarity index 63% |
copy from third_party/WebKit/public/platform/WebRTCVoidRequest.h |
copy to third_party/WebKit/public/platform/WebStringUTF8Adaptor.h |
index bcdff34efa1be36fc28b5c2e9af551c974738ce4..243804983b7bdbfb4f3ecb7ae952a7495f11f469 100644 |
--- a/third_party/WebKit/public/platform/WebRTCVoidRequest.h |
+++ b/third_party/WebKit/public/platform/WebStringUTF8Adaptor.h |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2012 Google Inc. All rights reserved. |
+ * Copyright (C) 2016 Google Inc. All rights reserved. |
haraken
2016/01/12 23:44:37
Ditto. You can use the 3-line copyright.
|
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -28,46 +28,41 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef WebRTCVoidRequest_h |
-#define WebRTCVoidRequest_h |
+#ifndef WebStringUTF8Adaptor_h |
+#define WebStringUTF8Adaptor_h |
#include "WebCommon.h" |
-#include "WebNonCopyable.h" |
#include "WebPrivatePtr.h" |
-#include "WebString.h" |
+#include "base/strings/string_piece.h" |
+ |
+namespace WTF { |
+class CStringBuffer; |
+} |
namespace blink { |
-class RTCVoidRequest; |
+class WebString; |
-class WebRTCVoidRequest { |
+// This class lets you get UTF-8 data out of a String without mallocing a |
+// separate buffer to hold the data if the String happens to be 8 bit and |
+// contain only ASCII characters. |
+// |
+// The string passed to the constructor must outlive this class since the |
+// returned StringPiece might point into it (which is the whole point). |
+class BLINK_COMMON_EXPORT WebStringUTF8Adaptor { |
public: |
- WebRTCVoidRequest() { } |
- WebRTCVoidRequest(const WebRTCVoidRequest& other) { assign(other); } |
- ~WebRTCVoidRequest() { reset(); } |
- |
- WebRTCVoidRequest& operator=(const WebRTCVoidRequest& other) |
- { |
- assign(other); |
- return *this; |
- } |
- |
- BLINK_PLATFORM_EXPORT void assign(const WebRTCVoidRequest&); |
- |
- BLINK_PLATFORM_EXPORT void reset(); |
- bool isNull() const { return m_private.isNull(); } |
+ WebStringUTF8Adaptor(const WebString&); |
haraken
2016/01/12 23:44:37
Is it intentional that we don't have an explicit o
esprehn
2016/01/13 02:02:32
explicit
|
+ ~WebStringUTF8Adaptor(); |
- BLINK_PLATFORM_EXPORT void requestSucceeded() const; |
- BLINK_PLATFORM_EXPORT void requestFailed(const WebString& error) const; |
- |
-#if INSIDE_BLINK |
- BLINK_PLATFORM_EXPORT WebRTCVoidRequest(RTCVoidRequest*); |
-#endif |
+ base::StringPiece asStringPiece() const { return m_stringPiece; } |
private: |
- WebPrivatePtr<RTCVoidRequest> m_private; |
+ base::StringPiece m_stringPiece; |
+ |
+ // Holds the UTF-8 buffer backing the string piece if conversion was necessary. |
+ WebPrivatePtr<WTF::CStringBuffer> m_utf8Buffer; |
}; |
} // namespace blink |
-#endif // WebRTCVoidRequest_h |
+#endif |