Commit a9b08ccb authored by dcarney@chromium.org's avatar dcarney@chromium.org

remove remaining calls to old style MakeWeak

R=jochen@chromium.org
TBR=jamesr@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/15952012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202980 0039d316-1c4b-4281-b951-d872f2087c98
parent b37916c9
...@@ -164,10 +164,9 @@ class ExtensionImpl : public extensions::ChromeV8Extension { ...@@ -164,10 +164,9 @@ class ExtensionImpl : public extensions::ChromeV8Extension {
}; };
static void GCCallback(v8::Isolate* isolate, static void GCCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value> object, v8::Persistent<v8::Object>* object,
void* parameter) { GCCallbackArgs* args) {
v8::HandleScope handle_scope; v8::HandleScope handle_scope;
GCCallbackArgs* args = static_cast<GCCallbackArgs*>(parameter);
v8::Handle<v8::Context> context = args->callback->CreationContext(); v8::Handle<v8::Context> context = args->callback->CreationContext();
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
WebKit::WebScopedMicrotaskSuppression suppression; WebKit::WebScopedMicrotaskSuppression suppression;
......
...@@ -45,7 +45,9 @@ class ScopedPersistent { ...@@ -45,7 +45,9 @@ class ScopedPersistent {
return handle_; return handle_;
} }
void MakeWeak(void* parameters, v8::NearDeathCallback callback) { template<typename P>
void MakeWeak(P* parameters,
typename v8::WeakReferenceCallbacks<T, P>::Revivable callback) {
handle_.MakeWeak(GetIsolate(handle_), parameters, callback); handle_.MakeWeak(GetIsolate(handle_), parameters, callback);
} }
......
...@@ -1013,14 +1013,13 @@ void BrowserPlugin::PersistRequestObject( ...@@ -1013,14 +1013,13 @@ void BrowserPlugin::PersistRequestObject(
std::make_pair(id, new_item)); std::make_pair(id, new_item));
CHECK(result.second); // Inserted in the map. CHECK(result.second); // Inserted in the map.
AliveV8PermissionRequestItem* request_item = result.first->second; AliveV8PermissionRequestItem* request_item = result.first->second;
weak_request.MakeWeak(isolate, request_item, WeakCallbackForPersistObject); weak_request.MakeWeak(
isolate, static_cast<void*>(request_item), WeakCallbackForPersistObject);
} }
// static // static
void BrowserPlugin::WeakCallbackForPersistObject( void BrowserPlugin::WeakCallbackForPersistObject(
v8::Isolate* isolate, v8::Persistent<v8::Value> object, void* param) { v8::Isolate* isolate, v8::Persistent<v8::Value>* object, void* param) {
v8::Persistent<v8::Object> persistent_object =
v8::Persistent<v8::Object>::Cast(object);
AliveV8PermissionRequestItem* item_ptr = AliveV8PermissionRequestItem* item_ptr =
static_cast<AliveV8PermissionRequestItem*>(param); static_cast<AliveV8PermissionRequestItem*>(param);
...@@ -1028,8 +1027,7 @@ void BrowserPlugin::WeakCallbackForPersistObject( ...@@ -1028,8 +1027,7 @@ void BrowserPlugin::WeakCallbackForPersistObject(
base::WeakPtr<BrowserPlugin> plugin = item_ptr->second; base::WeakPtr<BrowserPlugin> plugin = item_ptr->second;
delete item_ptr; delete item_ptr;
persistent_object.Dispose(isolate); object->Dispose();
persistent_object.Clear();
if (plugin) { if (plugin) {
// Asynchronously remove item from |alive_v8_permission_request_objects_|. // Asynchronously remove item from |alive_v8_permission_request_objects_|.
......
...@@ -328,7 +328,7 @@ class CONTENT_EXPORT BrowserPlugin : ...@@ -328,7 +328,7 @@ class CONTENT_EXPORT BrowserPlugin :
void OnRequestObjectGarbageCollected(int request_id); void OnRequestObjectGarbageCollected(int request_id);
// V8 garbage collection callback for |object|. // V8 garbage collection callback for |object|.
static void WeakCallbackForPersistObject(v8::Isolate* isolate, static void WeakCallbackForPersistObject(v8::Isolate* isolate,
v8::Persistent<v8::Value> object, v8::Persistent<v8::Value>* object,
void* param); void* param);
// IPC message handlers. // IPC message handlers.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment