Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // This class represent a collection of DOM wrappers for a specific world. | 58 // This class represent a collection of DOM wrappers for a specific world. |
| 59 class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { | 59 class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { |
| 60 public: | 60 public: |
| 61 static PassRefPtr<DOMWrapperWorld> create(int worldId = -1, int extensionGro up = -1); | 61 static PassRefPtr<DOMWrapperWorld> create(int worldId = -1, int extensionGro up = -1); |
| 62 | 62 |
| 63 static const int mainWorldExtensionGroup = 0; | 63 static const int mainWorldExtensionGroup = 0; |
| 64 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte nsionGroup); | 64 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte nsionGroup); |
| 65 ~DOMWrapperWorld(); | 65 ~DOMWrapperWorld(); |
| 66 void dispose(); | |
| 66 | 67 |
| 67 static bool isolatedWorldsExist() { return isolatedWorldCount; } | 68 static bool isolatedWorldsExist() { return isolatedWorldCount; } |
| 68 static void allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& worlds); | 69 static void allWorldsInMainThread(Vector<DOMWrapperWorld*>& worlds); |
|
dcarney
2014/03/10 08:12:28
i don't see what ensures the safety of this. I th
haraken
2014/03/10 08:23:57
Fixed.
(Either is fine with me. Since current(),
| |
| 69 | 70 |
| 70 static DOMWrapperWorld* world(v8::Handle<v8::Context> context) | 71 static DOMWrapperWorld* world(v8::Handle<v8::Context> context) |
| 71 { | 72 { |
| 72 ASSERT(contextHasCorrectPrototype(context)); | 73 ASSERT(contextHasCorrectPrototype(context)); |
| 73 return V8PerContextData::world(context); | 74 return V8PerContextData::world(context); |
| 74 } | 75 } |
| 75 | 76 |
| 76 // Will return null if there is no DOMWrapperWorld for the current v8::Conte xt | 77 // Will return null if there is no DOMWrapperWorld for the current v8::Conte xt |
| 77 static DOMWrapperWorld* current(v8::Isolate*); | 78 static DOMWrapperWorld* current(v8::Isolate*); |
| 78 static DOMWrapperWorld* mainWorld(); | 79 static DOMWrapperWorld* mainWorld(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 static bool contextHasCorrectPrototype(v8::Handle<v8::Context>); | 112 static bool contextHasCorrectPrototype(v8::Handle<v8::Context>); |
| 112 | 113 |
| 113 const int m_worldId; | 114 const int m_worldId; |
| 114 const int m_extensionGroup; | 115 const int m_extensionGroup; |
| 115 OwnPtr<DOMDataStore> m_domDataStore; | 116 OwnPtr<DOMDataStore> m_domDataStore; |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 } // namespace WebCore | 119 } // namespace WebCore |
| 119 | 120 |
| 120 #endif // DOMWrapperWorld_h | 121 #endif // DOMWrapperWorld_h |
| OLD | NEW |