OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // | 132 // |
133 // The result can be set either synchronously while handling the request, | 133 // The result can be set either synchronously while handling the request, |
134 // or asynchronously after the method has returned. When completing | 134 // or asynchronously after the method has returned. When completing |
135 // asynchronously make a copy of the WebCryptoResult and call it from the | 135 // asynchronously make a copy of the WebCryptoResult and call it from the |
136 // same thread that started the request. | 136 // same thread that started the request. |
137 // | 137 // |
138 // ----------------------- | 138 // ----------------------- |
139 // Threading | 139 // Threading |
140 // ----------------------- | 140 // ----------------------- |
141 // | 141 // |
142 // The WebCrypto interface will only be called from the render's main | 142 // The WebCrypto interface will be called from blink threads (main or |
143 // thread. All communication back to Blink must be on this same thread. | 143 // web worker). All communication back to Blink must be on this same thread. |
| 144 // |
144 // Notably: | 145 // Notably: |
145 // | 146 // |
146 // * The WebCryptoResult is NOT threadsafe. It should only be used from | 147 // * The WebCryptoResult can be copied between threads, however all |
147 // the Blink main thread. | 148 // methods other than the destructor must be called from the origin |
| 149 // Blink thread. |
148 // | 150 // |
149 // * WebCryptoKey and WebCryptoAlgorithm ARE threadsafe. They can be | 151 // * WebCryptoKey and WebCryptoAlgorithm ARE threadsafe. They can be |
150 // safely copied between threads and accessed. Copying is cheap because | 152 // safely copied between threads and accessed. Copying is cheap because |
151 // they are internally reference counted. | 153 // they are internally reference counted. |
152 // | 154 // |
153 // * WebArrayBuffer is NOT threadsafe. It should only be created from the | 155 // * WebArrayBuffer is NOT threadsafe. It should only be created from the |
154 // Blink main thread. This means threaded implementations may have to | 156 // target Blink thread. This means threaded implementations may have to |
155 // make a copy of the output buffer. | 157 // make a copy of the output buffer. |
156 // | 158 // |
157 // ----------------------- | 159 // ----------------------- |
158 // Inputs | 160 // Inputs |
159 // ----------------------- | 161 // ----------------------- |
160 // | 162 // |
161 // * Data buffers are passed as (basePointer, byteLength) pairs. | 163 // * Data buffers are passed as (basePointer, byteLength) pairs. |
162 // These buffers are only valid during the call itself. Asynchronous | 164 // These buffers are only valid during the call itself. Asynchronous |
163 // implementations wishing to access it after the function returns | 165 // implementations wishing to access it after the function returns |
164 // should make a copy. | 166 // should make a copy. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Returns true on success. | 256 // Returns true on success. |
255 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } | 257 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } |
256 | 258 |
257 protected: | 259 protected: |
258 virtual ~WebCrypto() { } | 260 virtual ~WebCrypto() { } |
259 }; | 261 }; |
260 | 262 |
261 } // namespace blink | 263 } // namespace blink |
262 | 264 |
263 #endif | 265 #endif |
OLD | NEW |