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

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

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
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 #ifndef EXTENSIONS_RENDERER_WORKER_SCRIPT_CONTEXT_SET_H_ 5 #ifndef EXTENSIONS_RENDERER_WORKER_SCRIPT_CONTEXT_SET_H_
6 #define EXTENSIONS_RENDERER_WORKER_SCRIPT_CONTEXT_SET_H_ 6 #define EXTENSIONS_RENDERER_WORKER_SCRIPT_CONTEXT_SET_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
11 #include "base/threading/thread_local.h" 12 #include "base/threading/thread_local.h"
12 #include "content/public/child/worker_thread.h" 13 #include "content/public/child/worker_thread.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 #include "v8/include/v8.h" 15 #include "v8/include/v8.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 class ScriptContext; 19 class ScriptContext;
19 20
20 // A set of ScriptContexts owned by worker threads. Thread safe. 21 // A set of ScriptContexts owned by worker threads. Thread safe.
21 class WorkerScriptContextSet : public content::WorkerThread::Observer { 22 class WorkerScriptContextSet : public content::WorkerThread::Observer {
22 public: 23 public:
23 WorkerScriptContextSet(); 24 WorkerScriptContextSet();
24 25
25 ~WorkerScriptContextSet() override; 26 ~WorkerScriptContextSet() override;
26 27
27 // Inserts |context| into the set. Contexts are stored in TLS. 28 // Inserts |context| into the set. Contexts are stored in TLS.
28 void Insert(scoped_ptr<ScriptContext> context); 29 void Insert(std::unique_ptr<ScriptContext> context);
29 30
30 // Removes the ScriptContext associated with |v8_context| which was added for 31 // Removes the ScriptContext associated with |v8_context| which was added for
31 // |url| (used for sanity checking). 32 // |url| (used for sanity checking).
32 void Remove(v8::Local<v8::Context> v8_context, const GURL& url); 33 void Remove(v8::Local<v8::Context> v8_context, const GURL& url);
33 34
34 private: 35 private:
35 // WorkerThread::Observer: 36 // WorkerThread::Observer:
36 void WillStopCurrentWorkerThread() override; 37 void WillStopCurrentWorkerThread() override;
37 38
38 // Implement thread safety by storing each ScriptContext in TLS. 39 // Implement thread safety by storing each ScriptContext in TLS.
39 base::ThreadLocalPointer<ScopedVector<ScriptContext>> contexts_tls_; 40 base::ThreadLocalPointer<ScopedVector<ScriptContext>> contexts_tls_;
40 41
41 DISALLOW_COPY_AND_ASSIGN(WorkerScriptContextSet); 42 DISALLOW_COPY_AND_ASSIGN(WorkerScriptContextSet);
42 }; 43 };
43 44
44 } // namespace extensions 45 } // namespace extensions
45 46
46 #endif // EXTENSIONS_RENDERER_WORKER_SCRIPT_CONTEXT_SET_H_ 47 #endif // EXTENSIONS_RENDERER_WORKER_SCRIPT_CONTEXT_SET_H_
OLDNEW
« no previous file with comments | « extensions/renderer/wake_event_page.cc ('k') | extensions/renderer/worker_script_context_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698