OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 map_template_.Reset(GetIsolate(), raw_template); | 317 map_template_.Reset(GetIsolate(), raw_template); |
318 } | 318 } |
319 Handle<ObjectTemplate> templ = | 319 Handle<ObjectTemplate> templ = |
320 Local<ObjectTemplate>::New(GetIsolate(), map_template_); | 320 Local<ObjectTemplate>::New(GetIsolate(), map_template_); |
321 | 321 |
322 // Create an empty map wrapper. | 322 // Create an empty map wrapper. |
323 Handle<Object> result = templ->NewInstance(); | 323 Handle<Object> result = templ->NewInstance(); |
324 | 324 |
325 // Wrap the raw C++ pointer in an External so it can be referenced | 325 // Wrap the raw C++ pointer in an External so it can be referenced |
326 // from within JavaScript. | 326 // from within JavaScript. |
327 Handle<External> map_ptr = External::New(obj); | 327 Handle<External> map_ptr = External::New(GetIsolate(), obj); |
328 | 328 |
329 // Store the map pointer in the JavaScript wrapper. | 329 // Store the map pointer in the JavaScript wrapper. |
330 result->SetInternalField(0, map_ptr); | 330 result->SetInternalField(0, map_ptr); |
331 | 331 |
332 // Return the result through the current handle scope. Since each | 332 // Return the result through the current handle scope. Since each |
333 // of these handles will go away when the handle scope is deleted | 333 // of these handles will go away when the handle scope is deleted |
334 // we need to call Close to let one, the result, escape into the | 334 // we need to call Close to let one, the result, escape into the |
335 // outer handle scope. | 335 // outer handle scope. |
336 return handle_scope.Close(result); | 336 return handle_scope.Close(result); |
337 } | 337 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 request_template_.Reset(GetIsolate(), raw_template); | 425 request_template_.Reset(GetIsolate(), raw_template); |
426 } | 426 } |
427 Handle<ObjectTemplate> templ = | 427 Handle<ObjectTemplate> templ = |
428 Local<ObjectTemplate>::New(GetIsolate(), request_template_); | 428 Local<ObjectTemplate>::New(GetIsolate(), request_template_); |
429 | 429 |
430 // Create an empty http request wrapper. | 430 // Create an empty http request wrapper. |
431 Handle<Object> result = templ->NewInstance(); | 431 Handle<Object> result = templ->NewInstance(); |
432 | 432 |
433 // Wrap the raw C++ pointer in an External so it can be referenced | 433 // Wrap the raw C++ pointer in an External so it can be referenced |
434 // from within JavaScript. | 434 // from within JavaScript. |
435 Handle<External> request_ptr = External::New(request); | 435 Handle<External> request_ptr = External::New(GetIsolate(), request); |
436 | 436 |
437 // Store the request pointer in the JavaScript wrapper. | 437 // Store the request pointer in the JavaScript wrapper. |
438 result->SetInternalField(0, request_ptr); | 438 result->SetInternalField(0, request_ptr); |
439 | 439 |
440 // Return the result through the current handle scope. Since each | 440 // Return the result through the current handle scope. Since each |
441 // of these handles will go away when the handle scope is deleted | 441 // of these handles will go away when the handle scope is deleted |
442 // we need to call Close to let one, the result, escape into the | 442 // we need to call Close to let one, the result, escape into the |
443 // outer handle scope. | 443 // outer handle scope. |
444 return handle_scope.Close(result); | 444 return handle_scope.Close(result); |
445 } | 445 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 JsHttpRequestProcessor processor(isolate, source); | 644 JsHttpRequestProcessor processor(isolate, source); |
645 map<string, string> output; | 645 map<string, string> output; |
646 if (!processor.Initialize(&options, &output)) { | 646 if (!processor.Initialize(&options, &output)) { |
647 fprintf(stderr, "Error initializing processor.\n"); | 647 fprintf(stderr, "Error initializing processor.\n"); |
648 return 1; | 648 return 1; |
649 } | 649 } |
650 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) | 650 if (!ProcessEntries(&processor, kSampleSize, kSampleRequests)) |
651 return 1; | 651 return 1; |
652 PrintMap(&output); | 652 PrintMap(&output); |
653 } | 653 } |
OLD | NEW |