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

Side by Side Diff: Source/bindings/core/v8/ScriptWrappable.h

Issue 398673003: Rename WebCore namespace to blink in bindings and web (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
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 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 25 matching lines...) Expand all
36 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
37 #include <v8.h> 37 #include <v8.h>
38 38
39 // Helper to call webCoreInitializeScriptWrappableForInterface in the global nam espace. 39 // Helper to call webCoreInitializeScriptWrappableForInterface in the global nam espace.
40 template <class C> inline void initializeScriptWrappableHelper(C* object) 40 template <class C> inline void initializeScriptWrappableHelper(C* object)
41 { 41 {
42 void webCoreInitializeScriptWrappableForInterface(C*); 42 void webCoreInitializeScriptWrappableForInterface(C*);
43 webCoreInitializeScriptWrappableForInterface(object); 43 webCoreInitializeScriptWrappableForInterface(object);
44 } 44 }
45 45
46 namespace WebCore { 46 namespace blink {
47 47
48 /** 48 /**
49 * ScriptWrappable wraps a V8 object and its WrapperTypeInfo. 49 * ScriptWrappable wraps a V8 object and its WrapperTypeInfo.
50 * 50 *
51 * ScriptWrappable acts much like a v8::Persistent<> in that it keeps a 51 * ScriptWrappable acts much like a v8::Persistent<> in that it keeps a
52 * V8 object alive. Under the hood, however, it keeps either a TypeInfo 52 * V8 object alive. Under the hood, however, it keeps either a TypeInfo
53 * object or an actual v8 persistent (or is empty). 53 * object or an actual v8 persistent (or is empty).
54 * 54 *
55 * The physical state space of ScriptWrappable is: 55 * The physical state space of ScriptWrappable is:
56 * - uintptr_t m_wrapperOrTypeInfo; 56 * - uintptr_t m_wrapperOrTypeInfo;
57 * - if 0: the ScriptWrappable is uninitialized/empty. 57 * - if 0: the ScriptWrappable is uninitialized/empty.
58 * - if even: a pointer to WebCore::TypeInfo 58 * - if even: a pointer to blink::TypeInfo
59 * - if odd: a pointer to v8::Persistent<v8::Object> + 1. 59 * - if odd: a pointer to v8::Persistent<v8::Object> + 1.
60 * 60 *
61 * In other words, one integer represents one of two object pointers, 61 * In other words, one integer represents one of two object pointers,
62 * depending on its least signficiant bit, plus an uninitialized state. 62 * depending on its least signficiant bit, plus an uninitialized state.
63 * This class is meant to mask the logistics behind this. 63 * This class is meant to mask the logistics behind this.
64 * 64 *
65 * typeInfo() and newLocalWrapper will return appropriate values (possibly 65 * typeInfo() and newLocalWrapper will return appropriate values (possibly
66 * 0/empty) in all physical states. 66 * 0/empty) in all physical states.
67 * 67 *
68 * The state transitions are: 68 * The state transitions are:
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 ASSERT(persistent == data.GetValue()); 272 ASSERT(persistent == data.GetValue());
273 data.GetParameter()->disposeWrapper(data.GetValue()); 273 data.GetParameter()->disposeWrapper(data.GetValue());
274 274
275 // FIXME: I noticed that 50%~ of minor GC cycle times can be consumed 275 // FIXME: I noticed that 50%~ of minor GC cycle times can be consumed
276 // inside data.GetParameter()->deref(), which causes Node destructions. We should 276 // inside data.GetParameter()->deref(), which causes Node destructions. We should
277 // make Node destructions incremental. 277 // make Node destructions incremental.
278 releaseObject(data.GetValue()); 278 releaseObject(data.GetValue());
279 } 279 }
280 }; 280 };
281 281
282 } // namespace WebCore 282 } // namespace blink
283 283
284 #endif // ScriptWrappable_h 284 #endif // ScriptWrappable_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptValue.cpp ('k') | Source/bindings/core/v8/SerializedScriptValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698