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

Side by Side Diff: src/wasm/managed.h

Issue 2424623002: [wasm] Use a Managed<WasmModule> to hold metadata about modules. (Closed)
Patch Set: [wasm] Use a Managed<WasmModule> to hold metadata about modules. Created 4 years, 2 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 | « src/snapshot/code-serializer.cc ('k') | src/wasm/module-decoder.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 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_WASM_MANAGED_H_ 5 #ifndef V8_WASM_MANAGED_H_
6 #define V8_WASM_MANAGED_H_ 6 #define V8_WASM_MANAGED_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/global-handles.h" 9 #include "src/global-handles.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 28 matching lines...) Expand all
39 Handle<Managed<CppType>> handle) { 39 Handle<Managed<CppType>> handle) {
40 Handle<Object> global_handle = isolate->global_handles()->Create(*handle); 40 Handle<Object> global_handle = isolate->global_handles()->Create(*handle);
41 GlobalHandles::MakeWeak(global_handle.location(), global_handle.location(), 41 GlobalHandles::MakeWeak(global_handle.location(), global_handle.location(),
42 &Managed<CppType>::Delete, 42 &Managed<CppType>::Delete,
43 v8::WeakCallbackType::kFinalizer); 43 v8::WeakCallbackType::kFinalizer);
44 } 44 }
45 static void Delete(const v8::WeakCallbackInfo<void>& data) { 45 static void Delete(const v8::WeakCallbackInfo<void>& data) {
46 Managed<CppType>** p = 46 Managed<CppType>** p =
47 reinterpret_cast<Managed<CppType>**>(data.GetParameter()); 47 reinterpret_cast<Managed<CppType>**>(data.GetParameter());
48 delete (*p)->get(); 48 delete (*p)->get();
49 (*p)->set_foreign_address(0);
49 GlobalHandles::Destroy(reinterpret_cast<Object**>(p)); 50 GlobalHandles::Destroy(reinterpret_cast<Object**>(p));
50 } 51 }
51 }; 52 };
52 } // namespace internal 53 } // namespace internal
53 } // namespace v8 54 } // namespace v8
54 55
55 #endif // V8_WASM_MANAGED_H_ 56 #endif // V8_WASM_MANAGED_H_
OLDNEW
« no previous file with comments | « src/snapshot/code-serializer.cc ('k') | src/wasm/module-decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698