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

Side by Side Diff: src/isolate.cc

Issue 1522703002: Add Isolate::DiscardThreadSpecificMetadata method to embedder API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove rocketsoftware wildcard from AUTHORS Created 5 years 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 | « src/isolate.h ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (per_thread == NULL) { 128 if (per_thread == NULL) {
129 per_thread = new PerIsolateThreadData(this, thread_id); 129 per_thread = new PerIsolateThreadData(this, thread_id);
130 thread_data_table_->Insert(per_thread); 130 thread_data_table_->Insert(per_thread);
131 } 131 }
132 DCHECK(thread_data_table_->Lookup(this, thread_id) == per_thread); 132 DCHECK(thread_data_table_->Lookup(this, thread_id) == per_thread);
133 } 133 }
134 return per_thread; 134 return per_thread;
135 } 135 }
136 136
137 137
138 void Isolate::DiscardPerThreadDataForThisThread() {
139 int thread_id_int = base::Thread::GetThreadLocalInt(Isolate::thread_id_key_);
140 if (thread_id_int) {
141 ThreadId thread_id = ThreadId(thread_id_int);
142 DCHECK(!thread_manager_->mutex_owner_.Equals(thread_id));
143 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer());
144 PerIsolateThreadData* per_thread =
145 thread_data_table_->Lookup(this, thread_id);
146 if (per_thread) {
147 DCHECK(!per_thread->thread_state_);
148 thread_data_table_->Remove(per_thread);
149 }
150 }
151 }
152
153
138 Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThisThread() { 154 Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThisThread() {
139 ThreadId thread_id = ThreadId::Current(); 155 ThreadId thread_id = ThreadId::Current();
140 return FindPerThreadDataForThread(thread_id); 156 return FindPerThreadDataForThread(thread_id);
141 } 157 }
142 158
143 159
144 Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThread( 160 Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThread(
145 ThreadId thread_id) { 161 ThreadId thread_id) {
146 PerIsolateThreadData* per_thread = NULL; 162 PerIsolateThreadData* per_thread = NULL;
147 { 163 {
(...skipping 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 // Then check whether this scope intercepts. 2825 // Then check whether this scope intercepts.
2810 if ((flag & intercept_mask_)) { 2826 if ((flag & intercept_mask_)) {
2811 intercepted_flags_ |= flag; 2827 intercepted_flags_ |= flag;
2812 return true; 2828 return true;
2813 } 2829 }
2814 return false; 2830 return false;
2815 } 2831 }
2816 2832
2817 } // namespace internal 2833 } // namespace internal
2818 } // namespace v8 2834 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698