OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include "V8Worker.h" | 33 #include "V8Worker.h" |
34 | 34 |
35 #include "core/workers/Worker.h" | 35 #include "core/workers/Worker.h" |
36 | 36 |
37 #include "bindings/v8/SerializedScriptValue.h" | 37 #include "bindings/v8/SerializedScriptValue.h" |
38 #include "bindings/v8/V8Binding.h" | 38 #include "bindings/v8/V8Binding.h" |
39 #include "bindings/v8/V8Utilities.h" | 39 #include "bindings/v8/V8Utilities.h" |
40 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
41 #include "core/page/Frame.h" | 41 #include "core/page/Frame.h" |
42 #include "core/workers/WorkerContext.h" | 42 #include "core/workers/WorkerGlobalScope.h" |
43 #include "wtf/ArrayBuffer.h" | 43 #include "wtf/ArrayBuffer.h" |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 void V8Worker::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>
& args) | 47 void V8Worker::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>
& args) |
48 { | 48 { |
49 Worker* worker = V8Worker::toNative(args.Holder()); | 49 Worker* worker = V8Worker::toNative(args.Holder()); |
50 MessagePortArray ports; | 50 MessagePortArray ports; |
51 ArrayBufferArray arrayBuffers; | 51 ArrayBufferArray arrayBuffers; |
52 if (args.Length() > 1) { | 52 if (args.Length() > 1) { |
53 if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate(
))) | 53 if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate(
))) |
54 return; | 54 return; |
55 } | 55 } |
56 bool didThrow = false; | 56 bool didThrow = false; |
57 RefPtr<SerializedScriptValue> message = | 57 RefPtr<SerializedScriptValue> message = |
58 SerializedScriptValue::create(args[0], | 58 SerializedScriptValue::create(args[0], |
59 &ports, | 59 &ports, |
60 &arrayBuffers, | 60 &arrayBuffers, |
61 didThrow, | 61 didThrow, |
62 args.GetIsolate()); | 62 args.GetIsolate()); |
63 if (didThrow) | 63 if (didThrow) |
64 return; | 64 return; |
65 ExceptionCode ec = 0; | 65 ExceptionCode ec = 0; |
66 worker->postMessage(message.release(), &ports, ec); | 66 worker->postMessage(message.release(), &ports, ec); |
67 setDOMException(ec, args.GetIsolate()); | 67 setDOMException(ec, args.GetIsolate()); |
68 } | 68 } |
69 | 69 |
70 } // namespace WebCore | 70 } // namespace WebCore |
OLD | NEW |