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

Unified Diff: third_party/WebKit/Source/platform/SharedBuffer.h

Issue 2530323002: Replace boolean return value SharedBuffer::getAsBytes with DCHECK (Closed)
Patch Set: done Created 4 years, 1 month 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
Index: third_party/WebKit/Source/platform/SharedBuffer.h
diff --git a/third_party/WebKit/Source/platform/SharedBuffer.h b/third_party/WebKit/Source/platform/SharedBuffer.h
index 299e8c1a68677a0533d00fbc3d9d93cfc8e53909..f8c00264cb30432b8bfa9365f913c470f85e73f2 100644
--- a/third_party/WebKit/Source/platform/SharedBuffer.h
+++ b/third_party/WebKit/Source/platform/SharedBuffer.h
@@ -113,15 +113,14 @@ class PLATFORM_EXPORT SharedBuffer : public RefCounted<SharedBuffer> {
}
// Returns the content data into "dest" as a flat buffer. "byteLength" must
- // exactly match with size(). Returns true on success, otherwise the content
- // of "dest" is not guaranteed.
+ // exactly match with size(). |dest| must not be null even if |bytesLength|
+ // is 0.
HAS_STRICTLY_TYPED_ARG
- bool getAsBytes(void* dest, STRICTLY_TYPED_ARG(byteLength)) const {
+ void getAsBytes(void* dest, STRICTLY_TYPED_ARG(byteLength)) const {
STRICT_ARG_TYPE(size_t);
- if (byteLength != size())
- return false;
-
- return getAsBytesInternal(dest, 0, byteLength);
+ DCHECK_EQ(byteLength, size());
+ auto result = getAsBytesInternal(dest, 0, byteLength);
+ DCHECK(result);
}
// Copies "byteLength" bytes from "position"-th bytes (0 origin) of the

Powered by Google App Engine
This is Rietveld 408576698