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

Unified Diff: components/cronet/android/cronet_url_request_context_adapter.h

Issue 586143002: Initial implementation of Cronet Async API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/cronet_url_request_context_adapter.h
diff --git a/components/cronet/android/url_request_context_adapter.h b/components/cronet/android/cronet_url_request_context_adapter.h
similarity index 50%
copy from components/cronet/android/url_request_context_adapter.h
copy to components/cronet/android/cronet_url_request_context_adapter.h
index 1bb2e70632d377b7366450f1e6f984c4a11e1b4d..a1c1fef952edd3686dc8b5298aabca6f8df507fe 100644
--- a/components/cronet/android/url_request_context_adapter.h
+++ b/components/cronet/android/cronet_url_request_context_adapter.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
-#define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
+#ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
+#define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
#include <string>
@@ -14,46 +14,40 @@
#include "base/threading/thread.h"
#include "net/base/net_log.h"
#include "net/base/network_change_notifier.h"
-#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
namespace net {
class NetLogLogger;
+class URLRequestContext;
} // namespace net
namespace cronet {
struct URLRequestContextConfig;
-// Implementation of the Chromium NetLog observer interface.
-class NetLogObserver : public net::NetLog::ThreadSafeObserver {
- public:
- explicit NetLogObserver() {}
-
- virtual ~NetLogObserver() {}
-
- virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NetLogObserver);
-};
-
// Fully configured |URLRequestContext|.
-class URLRequestContextAdapter : public net::URLRequestContextGetter {
+class CronetURLRequestContextAdapter : public net::URLRequestContextGetter {
public:
- class URLRequestContextAdapterDelegate
- : public base::RefCountedThreadSafe<URLRequestContextAdapterDelegate> {
+ class CronetURLRequestContextAdapterDelegate
+ : public base::RefCountedThreadSafe<
+ CronetURLRequestContextAdapterDelegate> {
public:
- virtual void OnContextInitialized(URLRequestContextAdapter* context) = 0;
+ virtual void OnContextInitialized(
+ CronetURLRequestContextAdapter* context) = 0;
protected:
- friend class base::RefCountedThreadSafe<URLRequestContextAdapterDelegate>;
+ friend class base::RefCountedThreadSafe<
+ CronetURLRequestContextAdapterDelegate>;
- virtual ~URLRequestContextAdapterDelegate() {}
+ virtual ~CronetURLRequestContextAdapterDelegate() {}
};
- URLRequestContextAdapter(URLRequestContextAdapterDelegate* delegate,
- std::string user_agent);
+ explicit CronetURLRequestContextAdapter(
+ CronetURLRequestContextAdapterDelegate* delegate);
void Initialize(scoped_ptr<URLRequestContextConfig> config);
const std::string& GetUserAgent(const GURL& url) const;
@@ -67,22 +61,23 @@ class URLRequestContextAdapter : public net::URLRequestContextGetter {
void StopNetLog();
private:
- scoped_refptr<URLRequestContextAdapterDelegate> delegate_;
+ scoped_refptr<CronetURLRequestContextAdapterDelegate> delegate_;
scoped_ptr<net::URLRequestContext> context_;
std::string user_agent_;
base::Thread* network_thread_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
- scoped_ptr<NetLogObserver> net_log_observer_;
scoped_ptr<net::NetLogLogger> net_log_logger_;
- virtual ~URLRequestContextAdapter();
+ virtual ~CronetURLRequestContextAdapter();
// Initializes |context_| on the Network thread.
- void InitializeURLRequestContext(scoped_ptr<URLRequestContextConfig> config);
+ void InitializeOnNetworkThread(scoped_ptr<URLRequestContextConfig> config);
+ void StartNetLogToFileOnNetworkThread(const std::string& file_name);
+ void StopNetLogOnNetworkThread();
- DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter);
+ DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
};
} // namespace cronet
-#endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
+#endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_

Powered by Google App Engine
This is Rietveld 408576698