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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContextFeatures.cpp

Issue 1855203002: Revert of Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 11 matching lines...) Expand all
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "core/dom/ContextFeatures.h" 27 #include "core/dom/ContextFeatures.h"
28 28
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/page/Page.h" 30 #include "core/page/Page.h"
31 #include "platform/RuntimeEnabledFeatures.h" 31 #include "platform/RuntimeEnabledFeatures.h"
32 #include "wtf/StdLibExtras.h"
33 32
34 namespace blink { 33 namespace blink {
35 34
36 PassOwnPtr<ContextFeaturesClient> ContextFeaturesClient::empty() 35 PassOwnPtr<ContextFeaturesClient> ContextFeaturesClient::empty()
37 { 36 {
38 return adoptPtr(new ContextFeaturesClient()); 37 return adoptPtr(new ContextFeaturesClient());
39 } 38 }
40 39
41 const char* ContextFeatures::supplementName() 40 const char* ContextFeatures::supplementName()
42 { 41 {
43 return "ContextFeatures"; 42 return "ContextFeatures";
44 } 43 }
45 44
46 ContextFeatures& ContextFeatures::defaultSwitch() 45 ContextFeatures* ContextFeatures::defaultSwitch()
47 { 46 {
48 DEFINE_STATIC_LOCAL(ContextFeatures, instance, (ContextFeatures::create(Cont extFeaturesClient::empty()))); 47 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(ContextFeatures, instance, (ContextFeat ures::create(ContextFeaturesClient::empty())));
49 return instance; 48 return instance;
50 } 49 }
51 50
52 bool ContextFeatures::pagePopupEnabled(Document* document) 51 bool ContextFeatures::pagePopupEnabled(Document* document)
53 { 52 {
54 if (!document) 53 if (!document)
55 return false; 54 return false;
56 return document->contextFeatures().isEnabled(document, PagePopup, false); 55 return document->contextFeatures().isEnabled(document, PagePopup, false);
57 } 56 }
58 57
(...skipping 12 matching lines...) Expand all
71 70
72 void provideContextFeaturesToDocumentFrom(Document& document, Page& page) 71 void provideContextFeaturesToDocumentFrom(Document& document, Page& page)
73 { 72 {
74 ContextFeatures* provided = static_cast<ContextFeatures*>(Supplement<Page>:: from(page, ContextFeatures::supplementName())); 73 ContextFeatures* provided = static_cast<ContextFeatures*>(Supplement<Page>:: from(page, ContextFeatures::supplementName()));
75 if (!provided) 74 if (!provided)
76 return; 75 return;
77 document.setContextFeatures(*provided); 76 document.setContextFeatures(*provided);
78 } 77 }
79 78
80 } // namespace blink 79 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContextFeatures.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698