Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| 6 #define CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/singleton.h" | |
| 11 | |
| 12 class GURL; | |
| 13 | |
| 14 namespace base { | |
| 15 class TaskRunner; | |
| 16 } // namespace base | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 // This is a singleton class called in the browser UI thread. | |
| 21 // It dispatches DTLS identity requests to the background worker thread. | |
| 22 class DTLSIdentityStore { | |
| 23 public: | |
| 24 static DTLSIdentityStore* GetInstance(); | |
|
Ryan Sleevi
2013/06/04 19:13:52
DESIGN: No new singletons.
DESIGN: You can't mix t
jiayl
2013/06/05 00:08:09
What's the alternative to singleton? I tried to fi
Ryan Sleevi
2013/06/06 23:57:37
The alternative to a Singleton is not using a Sing
jiayl
2013/06/07 00:31:25
jam@, could you give some suggestion on who should
jam
2013/06/07 00:46:49
if this code is per profile, then it should either
| |
| 25 DTLSIdentityStore(); | |
| 26 DTLSIdentityStore(const scoped_refptr<base::TaskRunner>& task_runner); | |
|
Ryan Sleevi
2013/06/04 19:13:52
STYLE: explicit
jiayl
2013/06/06 05:10:24
Done.
| |
| 27 ~DTLSIdentityStore(); | |
| 28 | |
| 29 typedef base::Callback<void(const std::string&, const std::string&)> | |
| 30 OnCompleteCallback; | |
| 31 | |
| 32 // Get the DTLS identity for the given domain of |url|, or generate a new one | |
| 33 // if not existent. Asynchronous. Called on the browser UI thread. | |
| 34 // |url| is the frame URL of the PeerConnection requesting the identity; | |
|
Ryan Sleevi
2013/06/04 19:13:52
STYLE: terms like "frame URL" don't really fit her
jiayl
2013/06/06 05:10:24
Renamed to origin.
| |
| 35 // |identity_name| is the name of the identity; | |
| 36 // |common_name| ??? | |
| 37 // |callback| is the callback to return the result. | |
| 38 void GetOrGenerateIdentity(const GURL& url, | |
| 39 const std::string& identity_name, | |
| 40 const std::string& common_name, | |
| 41 const OnCompleteCallback& callback | |
|
Ryan Sleevi
2013/06/04 19:13:52
DESIGN: If a requester goes away while an identity
jiayl
2013/06/06 05:10:24
How can we tell a requester goes away? It seems th
Ryan Sleevi
2013/06/06 23:57:37
Yes.
You're going to be performing expensive oper
jiayl
2013/06/07 00:24:07
But ServerBoundCertService does not remove a cance
jiayl
2013/06/13 21:50:45
OK, now the request is cancelled when the DTLSIden
| |
| 42 ); | |
|
Ryan Sleevi
2013/06/04 19:13:52
STYLE: closing parens go on the same line as the l
jiayl
2013/06/06 05:10:24
Done.
| |
| 43 private: | |
| 44 friend struct DefaultSingletonTraits<DTLSIdentityStore>; | |
| 45 | |
| 46 // The TaskRunner for doing work on a worker thread. | |
| 47 scoped_refptr<base::TaskRunner> task_runner_; | |
| 48 }; | |
| 49 | |
| 50 } // namespace content | |
| 51 | |
| 52 #endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| OLD | NEW |