diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-10-24 11:30:15 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-10-30 12:56:19 +0000 |
commit | 6036726eb981b6c4b42047513b9d3f4ac865daac (patch) | |
tree | 673593e70678e7789766d1f732eb51f613a2703b /chromium/base/win/scoped_bstr.h | |
parent | 466052c4e7c052268fd931888cd58961da94c586 (diff) | |
download | qtwebengine-chromium-6036726eb981b6c4b42047513b9d3f4ac865daac.tar.gz |
BASELINE: Update Chromium to 70.0.3538.78
Change-Id: Ie634710bf039e26c1957f4ae45e101bd4c434ae7
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/base/win/scoped_bstr.h')
-rw-r--r-- | chromium/base/win/scoped_bstr.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/chromium/base/win/scoped_bstr.h b/chromium/base/win/scoped_bstr.h index 2109c207a14..658e815dfa9 100644 --- a/chromium/base/win/scoped_bstr.h +++ b/chromium/base/win/scoped_bstr.h @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/strings/string16.h" +#include "base/strings/string_piece.h" namespace base { namespace win { @@ -21,19 +22,18 @@ namespace win { // The class interface is based on unique_ptr. class BASE_EXPORT ScopedBstr { public: - ScopedBstr() : bstr_(NULL) { - } + ScopedBstr() : bstr_(nullptr) {} // Constructor to create a new BSTR. // // NOTE: Do not pass a BSTR to this constructor expecting ownership to // be transferred - even though it compiles! ;-) - explicit ScopedBstr(const char16* non_bstr); + explicit ScopedBstr(StringPiece16 non_bstr); ~ScopedBstr(); - // Give ScopedBstr ownership over an already allocated BSTR or NULL. + // Give ScopedBstr ownership over an already allocated BSTR or null. // If you need to allocate a new BSTR instance, use |allocate| instead. - void Reset(BSTR bstr = NULL); + void Reset(BSTR bstr = nullptr); // Releases ownership of the BSTR to the caller. BSTR Release(); @@ -43,11 +43,11 @@ class BASE_EXPORT ScopedBstr { // If you already have a BSTR and want to transfer ownership to the // ScopedBstr instance, call |reset| instead. // - // Returns a pointer to the new BSTR, or NULL if allocation failed. - BSTR Allocate(const char16* str); + // Returns a pointer to the new BSTR. + BSTR Allocate(StringPiece16 str); // Allocates a new BSTR with the specified number of bytes. - // Returns a pointer to the new BSTR, or NULL if allocation failed. + // Returns a pointer to the new BSTR. BSTR AllocateBytes(size_t bytes); // Sets the allocated length field of the already-allocated BSTR to be @@ -68,7 +68,7 @@ class BASE_EXPORT ScopedBstr { // Retrieves the pointer address. // Used to receive BSTRs as out arguments (and take ownership). - // The function DCHECKs on the current value being NULL. + // The function DCHECKs on the current value being null. // Usage: GetBstr(bstr.Receive()); BSTR* Receive(); @@ -82,14 +82,15 @@ class BASE_EXPORT ScopedBstr { return bstr_; } + // Forbid comparison of ScopedBstr types. You should never have the same + // BSTR owned by two different scoped_ptrs. + bool operator==(const ScopedBstr& bstr2) const = delete; + bool operator!=(const ScopedBstr& bstr2) const = delete; + protected: BSTR bstr_; private: - // Forbid comparison of ScopedBstr types. You should never have the same - // BSTR owned by two different scoped_ptrs. - bool operator==(const ScopedBstr& bstr2) const; - bool operator!=(const ScopedBstr& bstr2) const; DISALLOW_COPY_AND_ASSIGN(ScopedBstr); }; |