webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
com.google.protobuf.LazyFieldLite Class Reference
Inheritance diagram for com.google.protobuf.LazyFieldLite:
com.google.protobuf.LazyField

Public Member Functions

 LazyFieldLite (ExtensionRegistryLite extensionRegistry, ByteString bytes)
 
 LazyFieldLite ()
 
boolean equals (Object o)
 
int hashCode ()
 
boolean containsDefaultInstance ()
 
void clear ()
 
void set (LazyFieldLite other)
 
MessageLite getValue (MessageLite defaultInstance)
 
MessageLite setValue (MessageLite value)
 
void merge (LazyFieldLite other)
 
void mergeFrom (CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
 
void setByteString (ByteString bytes, ExtensionRegistryLite extensionRegistry)
 
int getSerializedSize ()
 
ByteString toByteString ()
 

Static Public Member Functions

static LazyFieldLite fromValue (MessageLite value)
 

Protected Member Functions

void ensureInitialized (MessageLite defaultInstance)
 

Protected Attributes

volatile MessageLite value
 

Detailed Description

LazyFieldLite encapsulates the logic of lazily parsing message fields. It stores the message in a ByteString initially and then parses it on-demand.

LazyFieldLite is thread-compatible: concurrent reads are safe once the proto that this LazyFieldLite is a part of is no longer being mutated by its Builder. However, explicit synchronization is needed under read/write situations.

When a LazyFieldLite is used in the context of a MessageLite object, its behavior is considered to be immutable and none of the setter methods in its API are expected to be invoked. All of the getters are expected to be thread-safe. When used in the context of a MessageLite.Builder, setters can be invoked, but there is no guarantee of thread safety.

TODO(yatin,dweis): Consider splitting this class's functionality and put the mutable methods into a separate builder class to allow us to give stronger compile-time guarantees.

This class is internal implementation detail of the protobuf library, so you don't need to use it directly.

Author
xiang.nosp@m.l@go.nosp@m.ogle..nosp@m.com (Xiang Li)

Constructor & Destructor Documentation

◆ LazyFieldLite() [1/2]

com.google.protobuf.LazyFieldLite.LazyFieldLite ( ExtensionRegistryLite  extensionRegistry,
ByteString  bytes 
)
inline

Constructs a LazyFieldLite with bytes that will be parsed lazily.

◆ LazyFieldLite() [2/2]

com.google.protobuf.LazyFieldLite.LazyFieldLite ( )
inline

Constructs a LazyFieldLite with no contents, and no ability to parse extensions.

Member Function Documentation

◆ clear()

void com.google.protobuf.LazyFieldLite.clear ( )
inline

Clears the value state of this instance.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

◆ containsDefaultInstance()

boolean com.google.protobuf.LazyFieldLite.containsDefaultInstance ( )
inline

Determines whether this LazyFieldLite instance represents the default instance of this type.

◆ ensureInitialized()

void com.google.protobuf.LazyFieldLite.ensureInitialized ( MessageLite  defaultInstance)
inlineprotected

Might lazily parse the bytes that were previously passed in. Is thread-safe.

◆ equals()

boolean com.google.protobuf.LazyFieldLite.equals ( Object  o)
inline

◆ fromValue()

static LazyFieldLite com.google.protobuf.LazyFieldLite.fromValue ( MessageLite  value)
inlinestatic

Constructs a LazyFieldLite instance with a value. The LazyFieldLite may not be able to parse the extensions in the value as it has no ExtensionRegistry.

◆ getSerializedSize()

int com.google.protobuf.LazyFieldLite.getSerializedSize ( )
inline

Due to the optional field can be duplicated at the end of serialized bytes, which will make the serialized size changed after LazyField parsed. Be careful when using this method.

◆ getValue()

MessageLite com.google.protobuf.LazyFieldLite.getValue ( MessageLite  defaultInstance)
inline

Returns message instance. It may do some thread-safe delayed parsing of bytes.

Parameters
defaultInstanceits message's default instance. It's also used to get parser for the message type.

◆ hashCode()

int com.google.protobuf.LazyFieldLite.hashCode ( void  )
inline

◆ merge()

void com.google.protobuf.LazyFieldLite.merge ( LazyFieldLite  other)
inline

Merges another instance's contents. In some cases may drop some extensions if both fields contain data. If the other field has an

ExtensionRegistry

but this does not, then this field will copy over that

ExtensionRegistry

.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

◆ mergeFrom()

void com.google.protobuf.LazyFieldLite.mergeFrom ( CodedInputStream  input,
ExtensionRegistryLite  extensionRegistry 
) throws IOException
inline

Merges another instance's contents from a stream.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

◆ set()

void com.google.protobuf.LazyFieldLite.set ( LazyFieldLite  other)
inline

Overrides the contents of this LazyField.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

◆ setByteString()

void com.google.protobuf.LazyFieldLite.setByteString ( ByteString  bytes,
ExtensionRegistryLite  extensionRegistry 
)
inline

Sets this field with bytes to delay-parse.

◆ setValue()

MessageLite com.google.protobuf.LazyFieldLite.setValue ( MessageLite  value)
inline

Sets the value of the instance and returns the old value without delay parsing anything.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

◆ toByteString()

ByteString com.google.protobuf.LazyFieldLite.toByteString ( )
inline

Returns a BytesString for this field in a thread-safe way.

Member Data Documentation

◆ value

volatile MessageLite com.google.protobuf.LazyFieldLite.value
protected

The parsed value. When this is null and a caller needs access to the MessageLite value, then

delayedBytes

will be parsed lazily at that time.


The documentation for this class was generated from the following file: