зеркало из https://github.com/mozilla/gecko-dev.git
Bug 967936 - Reorder condition to avoid (benign) race with compression thread. r=jorendorff
This commit is contained in:
Родитель
8a21009f77
Коммит
e3a13e809a
|
@ -361,6 +361,15 @@ class ScriptSource
|
|||
{
|
||||
friend class SourceCompressionTask;
|
||||
|
||||
// A note on concurrency:
|
||||
//
|
||||
// The source may be compressed by a worker thread during parsing. (See
|
||||
// SourceCompressionTask.) When compression is running in the background,
|
||||
// ready() returns false. The compression thread touches the |data| union
|
||||
// and |compressedLength_|. Therefore, it is not safe to read these members
|
||||
// unless ready() is true. With that said, users of the public ScriptSource
|
||||
// API should be fine.
|
||||
|
||||
union {
|
||||
// Before setSourceCopy or setSource are successfully called, this union
|
||||
// has a nullptr pointer. When the script source is ready,
|
||||
|
@ -451,7 +460,7 @@ class ScriptSource
|
|||
bool ready() const { return ready_; }
|
||||
void setSourceRetrievable() { sourceRetrievable_ = true; }
|
||||
bool sourceRetrievable() const { return sourceRetrievable_; }
|
||||
bool hasSourceData() const { return !!data.source || !ready(); }
|
||||
bool hasSourceData() const { return !ready() || !!data.source; }
|
||||
uint32_t length() const {
|
||||
JS_ASSERT(hasSourceData());
|
||||
return length_;
|
||||
|
|
Загрузка…
Ссылка в новой задаче