mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add JSON parsing support (issue #1188).
This commit is contained in:
committed by
Marshall Greenblatt
parent
373180fef2
commit
d02f03a71a
@ -73,9 +73,41 @@ class CefValueImpl : public CefValue {
|
||||
bool SetDictionary(CefRefPtr<CefDictionaryValue> value) override;
|
||||
bool SetList(CefRefPtr<CefListValue> value) override;
|
||||
|
||||
// Ensures exclusive access to the underlying data for the life of this scoped
|
||||
// object.
|
||||
class ScopedLockedValue {
|
||||
public:
|
||||
explicit ScopedLockedValue(CefRefPtr<CefValueImpl> impl)
|
||||
: impl_(impl) {
|
||||
impl_->AcquireLock();
|
||||
}
|
||||
~ScopedLockedValue() {
|
||||
impl_->ReleaseLock();
|
||||
}
|
||||
|
||||
base::Value* value() const {
|
||||
return impl_->GetValueUnsafe();
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<CefValueImpl> impl_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedLockedValue);
|
||||
};
|
||||
|
||||
private:
|
||||
void SetValueInternal(base::Value* value);
|
||||
|
||||
// Returns the controller for the current value, if any.
|
||||
CefValueController* GetValueController() const;
|
||||
|
||||
// Explicitly lock/unlock this object and the underlying data.
|
||||
void AcquireLock();
|
||||
void ReleaseLock();
|
||||
|
||||
// Returns a reference to the underlying data. Access must be protected by
|
||||
// calling AcquireLock/ReleaseLock.
|
||||
base::Value* GetValueUnsafe() const;
|
||||
|
||||
// Access to all members must be protected by |lock_|.
|
||||
base::Lock lock_;
|
||||
|
||||
@ -127,6 +159,10 @@ class CefBinaryValueImpl
|
||||
bool IsSameValue(const base::BinaryValue* that);
|
||||
bool IsEqualValue(const base::BinaryValue* that);
|
||||
|
||||
// Returns the underlying value. Access must be protected by calling
|
||||
// lock/unlock on the controller.
|
||||
base::BinaryValue* GetValueUnsafe();
|
||||
|
||||
// CefBinaryValue methods.
|
||||
bool IsValid() override;
|
||||
bool IsOwned() override;
|
||||
@ -181,6 +217,10 @@ class CefDictionaryValueImpl
|
||||
bool IsSameValue(const base::DictionaryValue* that);
|
||||
bool IsEqualValue(const base::DictionaryValue* that);
|
||||
|
||||
// Returns the underlying value. Access must be protected by calling
|
||||
// lock/unlock on the controller.
|
||||
base::DictionaryValue* GetValueUnsafe();
|
||||
|
||||
// CefDictionaryValue methods.
|
||||
bool IsValid() override;
|
||||
bool IsOwned() override;
|
||||
@ -264,7 +304,11 @@ class CefListValueImpl
|
||||
bool IsSameValue(const base::ListValue* that);
|
||||
bool IsEqualValue(const base::ListValue* that);
|
||||
|
||||
/// CefListValue methods.
|
||||
// Returns the underlying value. Access must be protected by calling
|
||||
// lock/unlock on the controller.
|
||||
base::ListValue* GetValueUnsafe();
|
||||
|
||||
// CefListValue methods.
|
||||
bool IsValid() override;
|
||||
bool IsOwned() override;
|
||||
bool IsReadOnly() override;
|
||||
|
Reference in New Issue
Block a user