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

Side by Side Diff: src/messages.cc

Issue 12378069: Merged r13762 into 3.16 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.16
Patch Set: Created 7 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 | « src/api.cc ('k') | src/version.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 v8::NeanderArray global_listeners(FACTORY->message_listeners()); 124 v8::NeanderArray global_listeners(FACTORY->message_listeners());
125 int global_length = global_listeners.length(); 125 int global_length = global_listeners.length();
126 if (global_length == 0) { 126 if (global_length == 0) {
127 DefaultMessageReport(loc, message); 127 DefaultMessageReport(loc, message);
128 if (isolate->has_scheduled_exception()) { 128 if (isolate->has_scheduled_exception()) {
129 isolate->clear_scheduled_exception(); 129 isolate->clear_scheduled_exception();
130 } 130 }
131 } else { 131 } else {
132 for (int i = 0; i < global_length; i++) { 132 for (int i = 0; i < global_length; i++) {
133 HandleScope scope; 133 HandleScope scope(isolate);
134 if (global_listeners.get(i)->IsUndefined()) continue; 134 if (global_listeners.get(i)->IsUndefined()) continue;
135 Handle<Foreign> callback_obj(Foreign::cast(global_listeners.get(i))); 135 v8::NeanderObject listener(JSObject::cast(global_listeners.get(i)));
136 Handle<Foreign> callback_obj(Foreign::cast(listener.get(0)));
136 v8::MessageCallback callback = 137 v8::MessageCallback callback =
137 FUNCTION_CAST<v8::MessageCallback>(callback_obj->foreign_address()); 138 FUNCTION_CAST<v8::MessageCallback>(callback_obj->foreign_address());
139 Handle<Object> callback_data(listener.get(1), isolate);
138 { 140 {
139 // Do not allow exceptions to propagate. 141 // Do not allow exceptions to propagate.
140 v8::TryCatch try_catch; 142 v8::TryCatch try_catch;
141 callback(api_message_obj, api_exception_obj); 143 callback(api_message_obj, callback_data->IsUndefined()
144 ? api_exception_obj
145 : v8::Utils::ToLocal(callback_data));
142 } 146 }
143 if (isolate->has_scheduled_exception()) { 147 if (isolate->has_scheduled_exception()) {
144 isolate->clear_scheduled_exception(); 148 isolate->clear_scheduled_exception();
145 } 149 }
146 } 150 }
147 } 151 }
148 } 152 }
149 153
150 154
151 Handle<String> MessageHandler::GetMessage(Handle<Object> data) { 155 Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 187
184 188
185 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( 189 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
186 Handle<Object> data) { 190 Handle<Object> data) {
187 HandleScope scope; 191 HandleScope scope;
188 return GetMessage(data)->ToCString(DISALLOW_NULLS); 192 return GetMessage(data)->ToCString(DISALLOW_NULLS);
189 } 193 }
190 194
191 195
192 } } // namespace v8::internal 196 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698