Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: Source/bindings/core/v8/Dictionary.cpp

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptProfiler.cpp » ('j') | Source/wtf/Threading.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 30 matching lines...) Expand all
41 #include "bindings/core/v8/V8TextTrack.h" 41 #include "bindings/core/v8/V8TextTrack.h"
42 #include "bindings/core/v8/V8VoidCallback.h" 42 #include "bindings/core/v8/V8VoidCallback.h"
43 #include "bindings/core/v8/V8Window.h" 43 #include "bindings/core/v8/V8Window.h"
44 #include "core/html/track/TrackBase.h" 44 #include "core/html/track/TrackBase.h"
45 #include "wtf/MathExtras.h" 45 #include "wtf/MathExtras.h"
46 46
47 namespace blink { 47 namespace blink {
48 48
49 static ExceptionState& emptyExceptionState() 49 static ExceptionState& emptyExceptionState()
50 { 50 {
51 AtomicallyInitializedStatic(WTF::ThreadSpecific<NonThrowableExceptionState>* , exceptionState = new ThreadSpecific<NonThrowableExceptionState>); 51 AtomicallyInitializedStaticReference(WTF::ThreadSpecific<NonThrowableExcepti onState>, exceptionState, new ThreadSpecific<NonThrowableExceptionState>);
52 return **exceptionState; 52 return *exceptionState;
53 } 53 }
54 54
55 Dictionary::Dictionary() 55 Dictionary::Dictionary()
56 : m_isolate(0) 56 : m_isolate(0)
57 , m_exceptionState(&emptyExceptionState()) 57 , m_exceptionState(&emptyExceptionState())
58 { 58 {
59 } 59 }
60 60
61 Dictionary::Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate* isolat e, ExceptionState& exceptionState) 61 Dictionary::Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate* isolat e, ExceptionState& exceptionState)
62 : m_options(options) 62 : m_options(options)
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 return *this; 280 return *this;
281 } 281 }
282 282
283 void Dictionary::ConversionContext::throwTypeError(const String& detail) 283 void Dictionary::ConversionContext::throwTypeError(const String& detail)
284 { 284 {
285 exceptionState().throwTypeError(detail); 285 exceptionState().throwTypeError(detail);
286 } 286 }
287 287
288 } // namespace blink 288 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptProfiler.cpp » ('j') | Source/wtf/Threading.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698