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

Side by Side Diff: Source/wtf/ArrayBuffer.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/wtf/ArrayBuffer.h ('k') | Source/wtf/ArrayBufferContents.h » ('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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 22 matching lines...) Expand all
33 33
34 bool ArrayBuffer::transfer(ArrayBufferContents& result) 34 bool ArrayBuffer::transfer(ArrayBufferContents& result)
35 { 35 {
36 RefPtr<ArrayBuffer> keepAlive(this); 36 RefPtr<ArrayBuffer> keepAlive(this);
37 37
38 if (!m_contents.data()) { 38 if (!m_contents.data()) {
39 result.clear(); 39 result.clear();
40 return false; 40 return false;
41 } 41 }
42 42
43 if (m_contents.shared()) {
44 m_contents.transfer(result);
45 return true;
46 }
47
43 bool allViewsAreNeuterable = true; 48 bool allViewsAreNeuterable = true;
44 for (ArrayBufferView* i = m_firstView; i; i = i->m_nextView) { 49 for (ArrayBufferView* i = m_firstView; i; i = i->m_nextView) {
45 if (!i->isNeuterable()) 50 if (!i->isNeuterable())
46 allViewsAreNeuterable = false; 51 allViewsAreNeuterable = false;
47 } 52 }
48 53
49 if (allViewsAreNeuterable) { 54 if (allViewsAreNeuterable) {
50 m_contents.transfer(result); 55 m_contents.transfer(result);
51 } else { 56 } else {
52 m_contents.copyTo(result); 57 m_contents.copyTo(result);
(...skipping 29 matching lines...) Expand all
82 if (view->m_nextView) 87 if (view->m_nextView)
83 view->m_nextView->m_prevView = view->m_prevView; 88 view->m_nextView->m_prevView = view->m_prevView;
84 if (view->m_prevView) 89 if (view->m_prevView)
85 view->m_prevView->m_nextView = view->m_nextView; 90 view->m_prevView->m_nextView = view->m_nextView;
86 if (m_firstView == view) 91 if (m_firstView == view)
87 m_firstView = view->m_nextView; 92 m_firstView = view->m_nextView;
88 view->m_prevView = view->m_nextView = 0; 93 view->m_prevView = view->m_nextView = 0;
89 } 94 }
90 95
91 } 96 }
OLDNEW
« no previous file with comments | « Source/wtf/ArrayBuffer.h ('k') | Source/wtf/ArrayBufferContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698