| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 static void setDebugData(v8::Handle<v8::Context> context, v8::Handle<v8::Value>
value) | 188 static void setDebugData(v8::Handle<v8::Context> context, v8::Handle<v8::Value>
value) |
| 189 { | 189 { |
| 190 v8::Context::Scope contextScope(context); | 190 v8::Context::Scope contextScope(context); |
| 191 context->SetEmbedderData(v8ContextDebugIdIndex, value); | 191 context->SetEmbedderData(v8ContextDebugIdIndex, value); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool V8PerContextDebugData::setContextDebugData(v8::Handle<v8::Context> context,
const char* worldName, int debugId) | 194 bool V8PerContextDebugData::setContextDebugData(v8::Handle<v8::Context> context,
const char* worldName, int debugId) |
| 195 { | 195 { |
| 196 if (!debugData(context)->IsUndefined()) | 196 if (!debugData(context)->IsUndefined()) |
| 197 return false; | 197 return false; |
| 198 v8::HandleScope scope; | 198 v8::HandleScope scope(context->GetIsolate()); |
| 199 v8::Handle<v8::Value> debugData = createDebugData(worldName, debugId); | 199 v8::Handle<v8::Value> debugData = createDebugData(worldName, debugId); |
| 200 setDebugData(context, debugData); | 200 setDebugData(context, debugData); |
| 201 return true; | 201 return true; |
| 202 } | 202 } |
| 203 | 203 |
| 204 int V8PerContextDebugData::contextDebugId(v8::Handle<v8::Context> context) | 204 int V8PerContextDebugData::contextDebugId(v8::Handle<v8::Context> context) |
| 205 { | 205 { |
| 206 v8::HandleScope scope; | 206 v8::HandleScope scope(context->GetIsolate()); |
| 207 v8::Handle<v8::Value> data = debugData(context); | 207 v8::Handle<v8::Value> data = debugData(context); |
| 208 | 208 |
| 209 if (!data->IsString()) | 209 if (!data->IsString()) |
| 210 return -1; | 210 return -1; |
| 211 v8::String::AsciiValue ascii(data); | 211 v8::String::AsciiValue ascii(data); |
| 212 char* comma = strnstr(*ascii, ",", ascii.length()); | 212 char* comma = strnstr(*ascii, ",", ascii.length()); |
| 213 if (!comma) | 213 if (!comma) |
| 214 return -1; | 214 return -1; |
| 215 return atoi(comma + 1); | 215 return atoi(comma + 1); |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace WebCore | 218 } // namespace WebCore |
| OLD | NEW |