OLD | NEW |
1 // Copyright 2007-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 using ::v8::HandleScope; | 47 using ::v8::HandleScope; |
48 using ::v8::Local; | 48 using ::v8::Local; |
49 using ::v8::Object; | 49 using ::v8::Object; |
50 using ::v8::ObjectTemplate; | 50 using ::v8::ObjectTemplate; |
51 using ::v8::Persistent; | 51 using ::v8::Persistent; |
52 using ::v8::Script; | 52 using ::v8::Script; |
53 using ::v8::String; | 53 using ::v8::String; |
54 using ::v8::Value; | 54 using ::v8::Value; |
55 using ::v8::V8; | 55 using ::v8::V8; |
56 | 56 |
57 namespace i = ::i; | |
58 | |
59 | |
60 | |
61 | 57 |
62 // Migrating an isolate | 58 // Migrating an isolate |
63 class KangarooThread : public v8::internal::Thread { | 59 class KangarooThread : public v8::internal::Thread { |
64 public: | 60 public: |
65 KangarooThread(v8::Isolate* isolate, | 61 KangarooThread(v8::Isolate* isolate, |
66 v8::Handle<v8::Context> context, int value) | 62 v8::Handle<v8::Context> context, int value) |
67 : Thread("KangarooThread"), | 63 : Thread("KangarooThread"), |
68 isolate_(isolate), context_(context), value_(value) { | 64 isolate_(isolate), context_(context), value_(value) { |
69 } | 65 } |
70 | 66 |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 v8::Context::Scope context_scope(context); | 628 v8::Context::Scope context_scope(context); |
633 v8::Handle<String> source = v8::String::New("1+1"); | 629 v8::Handle<String> source = v8::String::New("1+1"); |
634 v8::Handle<Script> script = v8::Script::Compile(source); | 630 v8::Handle<Script> script = v8::Script::Compile(source); |
635 v8::Handle<Value> result = script->Run(); | 631 v8::Handle<Value> result = script->Run(); |
636 v8::String::AsciiValue ascii(result); | 632 v8::String::AsciiValue ascii(result); |
637 context.Dispose(); | 633 context.Dispose(); |
638 } | 634 } |
639 isolate->Dispose(); | 635 isolate->Dispose(); |
640 } | 636 } |
641 } | 637 } |
OLD | NEW |