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

Side by Side Diff: Source/bindings/dart/DartEventListener.cpp

Issue 185643003: Changes to use the modified dart API for (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1750/
Patch Set: Created 6 years, 9 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/dart/DartEventListener.h ('k') | Source/bindings/dart/DartStringCache.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 RefPtr<DartEventListener> listener = adoptRef(new DartEventListener()); 65 RefPtr<DartEventListener> listener = adoptRef(new DartEventListener());
66 listener->m_isolate = Dart_CurrentIsolate(); 66 listener->m_isolate = Dart_CurrentIsolate();
67 listener->m_listener = Dart_NewPrologueWeakPersistentHandle(closure, listene r.get(), &weakCallback); 67 listener->m_listener = Dart_NewPrologueWeakPersistentHandle(closure, listene r.get(), &weakCallback);
68 result = Dart_SetPeer(closure, listener.get()); 68 result = Dart_SetPeer(closure, listener.get());
69 ASSERT(!Dart_IsError(result)); 69 ASSERT(!Dart_IsError(result));
70 listener->ref(); 70 listener->ref();
71 return listener.get(); 71 return listener.get();
72 } 72 }
73 73
74 void DartEventListener::weakCallback(Dart_WeakPersistentHandle handle, void* pee r) 74 void DartEventListener::weakCallback(Dart_Isolate isolate, Dart_WeakPersistentHa ndle handle, void* peer)
75 { 75 {
76 DartEventListener* listener = static_cast<DartEventListener*>(peer); 76 DartEventListener* listener = static_cast<DartEventListener*>(peer);
77 listener->m_listener = 0; 77 listener->m_listener = 0;
78 listener->deref(); 78 listener->deref();
79 } 79 }
80 80
81 void DartEventListener::handleEvent(ExecutionContext* context, Event* event) 81 void DartEventListener::handleEvent(ExecutionContext* context, Event* event)
82 { 82 {
83 if (!m_listener) 83 if (!m_listener)
84 return; 84 return;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 DartController* dartController = DartController::retrieve(context); 139 DartController* dartController = DartController::retrieve(context);
140 if (!dartController) 140 if (!dartController)
141 return Dart_NewApiError("Internal error: failed to fetch Dart controller "); 141 return Dart_NewApiError("Internal error: failed to fetch Dart controller ");
142 142
143 Dart_Handle parameters[1] = { dartEvent }; 143 Dart_Handle parameters[1] = { dartEvent };
144 return dartController->callFunction(listener, 1, parameters); 144 return dartController->callFunction(listener, 1, parameters);
145 } 145 }
146 146
147 } 147 }
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartEventListener.h ('k') | Source/bindings/dart/DartStringCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698