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