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 29 matching lines...) Expand all Loading... | |
40 #include "wtf/ArrayBuffer.h" | 40 #include "wtf/ArrayBuffer.h" |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 void V8Worker::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & args) | 44 void V8Worker::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & args) |
45 { | 45 { |
46 Worker* worker = V8Worker::toNative(args.Holder()); | 46 Worker* worker = V8Worker::toNative(args.Holder()); |
47 MessagePortArray ports; | 47 MessagePortArray ports; |
48 ArrayBufferArray arrayBuffers; | 48 ArrayBufferArray arrayBuffers; |
49 if (args.Length() > 1) { | 49 if (args.Length() > 1) { |
50 if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate( ))) | 50 if (!extractTransferables(args[1], ports, arrayBuffers, |
51 args.GetIsolate(), "Second argument is not a sequence type")) | |
Mike West
2013/10/21 06:51:22
Ditto.
| |
51 return; | 52 return; |
52 } | 53 } |
53 bool didThrow = false; | 54 bool didThrow = false; |
54 RefPtr<SerializedScriptValue> message = | 55 RefPtr<SerializedScriptValue> message = |
55 SerializedScriptValue::create(args[0], | 56 SerializedScriptValue::create(args[0], |
56 &ports, | 57 &ports, |
57 &arrayBuffers, | 58 &arrayBuffers, |
58 didThrow, | 59 didThrow, |
59 args.GetIsolate()); | 60 args.GetIsolate()); |
60 if (didThrow) | 61 if (didThrow) |
61 return; | 62 return; |
62 ExceptionState es(args.GetIsolate()); | 63 ExceptionState es(args.GetIsolate()); |
63 worker->postMessage(message.release(), &ports, es); | 64 worker->postMessage(message.release(), &ports, es); |
64 es.throwIfNeeded(); | 65 es.throwIfNeeded(); |
65 } | 66 } |
66 | 67 |
67 } // namespace WebCore | 68 } // namespace WebCore |
OLD | NEW |