Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: Source/bindings/v8/SerializedScriptValue.cpp

Issue 148283013: Blink JavaScript shared memory prototype. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tweaks Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/v8/custom/V8ArrayBufferCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 if (visited.contains(arrayBuffers[i].get())) 2915 if (visited.contains(arrayBuffers[i].get()))
2916 continue; 2916 continue;
2917 visited.add(arrayBuffers[i].get()); 2917 visited.add(arrayBuffers[i].get());
2918 2918
2919 bool result = arrayBuffers[i]->transfer(contents->at(i)); 2919 bool result = arrayBuffers[i]->transfer(contents->at(i));
2920 if (!result) { 2920 if (!result) {
2921 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at ind ex " + String::number(i) + " could not be transferred."); 2921 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at ind ex " + String::number(i) + " could not be transferred.");
2922 return nullptr; 2922 return nullptr;
2923 } 2923 }
2924 2924
2925 neuterArrayBufferInAllWorlds(arrayBuffers[i].get()); 2925 if (!arrayBuffers[i]->isShared()) {
2926 neuterArrayBufferInAllWorlds(arrayBuffers[i].get());
2927 }
2926 } 2928 }
2927 return contents.release(); 2929 return contents.release();
2928 } 2930 }
2929 2931
2930 SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, Messag ePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blob Info, ExceptionState& exceptionState, v8::Isolate* isolate) 2932 SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, Messag ePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blob Info, ExceptionState& exceptionState, v8::Isolate* isolate)
2931 : m_externallyAllocatedMemory(0) 2933 : m_externallyAllocatedMemory(0)
2932 { 2934 {
2933 Writer writer; 2935 Writer writer;
2934 Serializer::Status status; 2936 Serializer::Status status;
2935 String errorMessage; 2937 String errorMessage;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 // If the allocated memory was not registered before, then this class is lik ely 3058 // If the allocated memory was not registered before, then this class is lik ely
3057 // used in a context other then Worker's onmessage environment and the prese nce of 3059 // used in a context other then Worker's onmessage environment and the prese nce of
3058 // current v8 context is not guaranteed. Avoid calling v8 then. 3060 // current v8 context is not guaranteed. Avoid calling v8 then.
3059 if (m_externallyAllocatedMemory) { 3061 if (m_externallyAllocatedMemory) {
3060 ASSERT(v8::Isolate::GetCurrent()); 3062 ASSERT(v8::Isolate::GetCurrent());
3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 3063 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
3062 } 3064 }
3063 } 3065 }
3064 3066
3065 } // namespace WebCore 3067 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/v8/custom/V8ArrayBufferCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698