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

Side by Side Diff: extensions/renderer/worker_script_context_set.cc

Issue 1899083003: Convert //extensions/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 | « extensions/renderer/worker_script_context_set.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium 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 "extensions/renderer/worker_script_context_set.h" 5 #include "extensions/renderer/worker_script_context_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
(...skipping 15 matching lines...) Expand all
26 }; 26 };
27 return std::find_if(contexts->begin(), contexts->end(), context_matches); 27 return std::find_if(contexts->begin(), contexts->end(), context_matches);
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 WorkerScriptContextSet::WorkerScriptContextSet() {} 32 WorkerScriptContextSet::WorkerScriptContextSet() {}
33 33
34 WorkerScriptContextSet::~WorkerScriptContextSet() {} 34 WorkerScriptContextSet::~WorkerScriptContextSet() {}
35 35
36 void WorkerScriptContextSet::Insert(scoped_ptr<ScriptContext> context) { 36 void WorkerScriptContextSet::Insert(std::unique_ptr<ScriptContext> context) {
37 DCHECK_GT(content::WorkerThread::GetCurrentId(), 0) 37 DCHECK_GT(content::WorkerThread::GetCurrentId(), 0)
38 << "Must be called on a worker thread"; 38 << "Must be called on a worker thread";
39 ContextVector* contexts = contexts_tls_.Get(); 39 ContextVector* contexts = contexts_tls_.Get();
40 if (!contexts) { 40 if (!contexts) {
41 // First context added for this thread. Create a new set, then wait for 41 // First context added for this thread. Create a new set, then wait for
42 // this thread's shutdown. 42 // this thread's shutdown.
43 contexts = new ContextVector(); 43 contexts = new ContextVector();
44 contexts_tls_.Set(contexts); 44 contexts_tls_.Set(contexts);
45 content::WorkerThread::AddObserver(this); 45 content::WorkerThread::AddObserver(this);
46 } 46 }
(...skipping 26 matching lines...) Expand all
73 content::WorkerThread::RemoveObserver(this); 73 content::WorkerThread::RemoveObserver(this);
74 ContextVector* contexts = contexts_tls_.Get(); 74 ContextVector* contexts = contexts_tls_.Get();
75 DCHECK(contexts); 75 DCHECK(contexts);
76 for (ScriptContext* context : *contexts) 76 for (ScriptContext* context : *contexts)
77 context->Invalidate(); 77 context->Invalidate();
78 contexts_tls_.Set(nullptr); 78 contexts_tls_.Set(nullptr);
79 delete contexts; 79 delete contexts;
80 } 80 }
81 81
82 } // namespace extensions 82 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/worker_script_context_set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698