From 0e16f4fafdac7cc80d9c1bd701358f6c58474eeb Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Fri, 17 May 2002 02:53:34 +0000 Subject: [PATCH] Make GetImplementationFlags more useful/extensible by changing the default implementation to return zero rather than returning the flags from the shared buffer handle, and add a constant for one expected future use. b=109571 r=jag sr=scc --- string/public/nsAString.h | 18 ++++++++++++++++-- string/src/nsAString.cpp | 12 ++---------- xpcom/string/public/nsAString.h | 18 ++++++++++++++++-- xpcom/string/src/nsAString.cpp | 12 ++---------- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/string/public/nsAString.h b/string/public/nsAString.h index c5168b04b50..9c4e115c861 100644 --- a/string/public/nsAString.h +++ b/string/public/nsAString.h @@ -114,8 +114,15 @@ class NS_COM nsAString // nsAString( const self_type& ); // auto-generated copy-constructor OK (again, only because we're abstract) virtual ~nsAString() { } // ...yes, I expect to be sub-classed - + enum { + kHasStackBuffer = 0x00000001 // Has and is using a buffer on + // the stack (that could be copied + // to the heap if + // GetSharedBufferHandle() is + // called). + }; virtual PRUint32 GetImplementationFlags() const; + virtual const buffer_handle_type* GetFlatBufferHandle() const; virtual const buffer_handle_type* GetBufferHandle() const; virtual const shared_buffer_handle_type* GetSharedBufferHandle() const; @@ -358,8 +365,15 @@ class NS_COM nsACString // nsACString( const self_type& ); // auto-generated copy-constructor OK (again, only because we're abstract) virtual ~nsACString() { } // ...yes, I expect to be sub-classed - + enum { + kHasStackBuffer = 0x00000001 // Has and is using a buffer on + // the stack (that could be copied + // to the heap if + // GetSharedBufferHandle() is + // called). + }; virtual PRUint32 GetImplementationFlags() const; + virtual const buffer_handle_type* GetFlatBufferHandle() const; virtual const buffer_handle_type* GetBufferHandle() const; virtual const shared_buffer_handle_type* GetSharedBufferHandle() const; diff --git a/string/src/nsAString.cpp b/string/src/nsAString.cpp index 612b90af43c..3aa5c965a48 100644 --- a/string/src/nsAString.cpp +++ b/string/src/nsAString.cpp @@ -106,11 +106,7 @@ nsAString::GetBufferHandle() const PRUint32 nsAString::GetImplementationFlags() const { - PRUint32 flags = 0; - const shared_buffer_handle_type* handle = GetSharedBufferHandle(); - if ( handle ) - flags = handle->GetImplementationFlags(); - return flags; + return 0; } @@ -605,11 +601,7 @@ nsACString::GetBufferHandle() const PRUint32 nsACString::GetImplementationFlags() const { - PRUint32 flags = 0; - const shared_buffer_handle_type* handle = GetSharedBufferHandle(); - if ( handle ) - flags = handle->GetImplementationFlags(); - return flags; + return 0; } diff --git a/xpcom/string/public/nsAString.h b/xpcom/string/public/nsAString.h index c5168b04b50..9c4e115c861 100644 --- a/xpcom/string/public/nsAString.h +++ b/xpcom/string/public/nsAString.h @@ -114,8 +114,15 @@ class NS_COM nsAString // nsAString( const self_type& ); // auto-generated copy-constructor OK (again, only because we're abstract) virtual ~nsAString() { } // ...yes, I expect to be sub-classed - + enum { + kHasStackBuffer = 0x00000001 // Has and is using a buffer on + // the stack (that could be copied + // to the heap if + // GetSharedBufferHandle() is + // called). + }; virtual PRUint32 GetImplementationFlags() const; + virtual const buffer_handle_type* GetFlatBufferHandle() const; virtual const buffer_handle_type* GetBufferHandle() const; virtual const shared_buffer_handle_type* GetSharedBufferHandle() const; @@ -358,8 +365,15 @@ class NS_COM nsACString // nsACString( const self_type& ); // auto-generated copy-constructor OK (again, only because we're abstract) virtual ~nsACString() { } // ...yes, I expect to be sub-classed - + enum { + kHasStackBuffer = 0x00000001 // Has and is using a buffer on + // the stack (that could be copied + // to the heap if + // GetSharedBufferHandle() is + // called). + }; virtual PRUint32 GetImplementationFlags() const; + virtual const buffer_handle_type* GetFlatBufferHandle() const; virtual const buffer_handle_type* GetBufferHandle() const; virtual const shared_buffer_handle_type* GetSharedBufferHandle() const; diff --git a/xpcom/string/src/nsAString.cpp b/xpcom/string/src/nsAString.cpp index 612b90af43c..3aa5c965a48 100644 --- a/xpcom/string/src/nsAString.cpp +++ b/xpcom/string/src/nsAString.cpp @@ -106,11 +106,7 @@ nsAString::GetBufferHandle() const PRUint32 nsAString::GetImplementationFlags() const { - PRUint32 flags = 0; - const shared_buffer_handle_type* handle = GetSharedBufferHandle(); - if ( handle ) - flags = handle->GetImplementationFlags(); - return flags; + return 0; } @@ -605,11 +601,7 @@ nsACString::GetBufferHandle() const PRUint32 nsACString::GetImplementationFlags() const { - PRUint32 flags = 0; - const shared_buffer_handle_type* handle = GetSharedBufferHandle(); - if ( handle ) - flags = handle->GetImplementationFlags(); - return flags; + return 0; }