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

Side by Side Diff: Source/bindings/v8/DOMWrapperWorld.cpp

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.h ('k') | Source/bindings/v8/PrivateScriptController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 { 60 {
61 } 61 }
62 62
63 DOMWrapperWorld& DOMWrapperWorld::mainWorld() 63 DOMWrapperWorld& DOMWrapperWorld::mainWorld()
64 { 64 {
65 ASSERT(isMainThread()); 65 ASSERT(isMainThread());
66 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create (MainWorldId, mainWorldExtensionGroup))); 66 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create (MainWorldId, mainWorldExtensionGroup)));
67 return *cachedMainWorld; 67 return *cachedMainWorld;
68 } 68 }
69 69
70 DOMWrapperWorld& DOMWrapperWorld::privateScriptWorld()
71 {
72 ASSERT(isMainThread());
73 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedPrivateScriptWorld, ());
74 DEFINE_STATIC_LOCAL(bool, isInitialized, (false));
75 if (!isInitialized) {
76 isInitialized = true;
77 cachedPrivateScriptWorld = DOMWrapperWorld::create(PrivateScriptIsolated WorldId, privateScriptIsolatedWorldExtensionGroup);
78 isolatedWorldCount++;
79 }
80 return *cachedPrivateScriptWorld;
81 }
82
70 typedef HashMap<int, DOMWrapperWorld*> WorldMap; 83 typedef HashMap<int, DOMWrapperWorld*> WorldMap;
71 static WorldMap& isolatedWorldMap() 84 static WorldMap& isolatedWorldMap()
72 { 85 {
73 ASSERT(isMainThread()); 86 ASSERT(isMainThread());
74 DEFINE_STATIC_LOCAL(WorldMap, map, ()); 87 DEFINE_STATIC_LOCAL(WorldMap, map, ());
75 return map; 88 return map;
76 } 89 }
77 90
78 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo rlds) 91 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo rlds)
79 { 92 {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S tring& policy) 196 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S tring& policy)
184 { 197 {
185 ASSERT(isIsolatedWorldId(worldId)); 198 ASSERT(isIsolatedWorldId(worldId));
186 if (!policy.isEmpty()) 199 if (!policy.isEmpty())
187 isolatedWorldContentSecurityPolicies().set(worldId, true); 200 isolatedWorldContentSecurityPolicies().set(worldId, true);
188 else 201 else
189 isolatedWorldContentSecurityPolicies().remove(worldId); 202 isolatedWorldContentSecurityPolicies().remove(worldId);
190 } 203 }
191 204
192 } // namespace WebCore 205 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.h ('k') | Source/bindings/v8/PrivateScriptController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698