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

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 comments, add more shutdown tests. 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/cronet_url_request_context_adapter.h b/components/cronet/android/cronet_url_request_context_adapter.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8e81c2e6c27ac5606084d808c110e533dacff80
--- /dev/null
+++ b/components/cronet/android/cronet_url_request_context_adapter.h
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
+#define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#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_getter.h"
mmenke 2014/10/31 15:49:22 Not used
mef 2014/10/31 20:39:16 Done.
+
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace net {
+class NetLogLogger;
+class URLRequestContext;
+} // namespace net
+
+namespace cronet {
+
+struct URLRequestContextConfig;
+
+// Adapter between Java CronetUrlRequestContext and URLRequestContextGetter.
mmenke 2014/10/31 15:49:22 URLRequestContextGetter -> URLRequestContext
mef 2014/10/31 20:39:16 Done.
+class CronetURLRequestContextAdapter {
+ public:
+ CronetURLRequestContextAdapter();
+ void Initialize(scoped_ptr<URLRequestContextConfig> config,
+ const base::Closure& init_java_network_thread);
mmenke 2014/10/31 15:49:22 nit: suggest a linebreak above and below Initiali
mef 2014/10/31 20:39:16 Done.
+ // Releases all resources for the request context and deletes the object.
+ void Destroy();
+
+ // net::URLRequestContextGetter implementation:
mmenke 2014/10/31 15:49:22 Not true.
mef 2014/10/31 20:39:16 Done.
+ net::URLRequestContext* GetURLRequestContext();
mmenke 2014/10/31 15:49:22 Add line break after method.
mef 2014/10/31 20:39:16 Done.
+ scoped_refptr<base::SingleThreadTaskRunner>
mmenke 2014/10/31 15:49:23 Maybe const scoped_refptr<>&, to avoid an extra re
mef 2014/10/31 20:39:16 Done.
+ GetNetworkTaskRunner() const;
+
+ void StartNetLogToFile(const std::string& file_name);
+ void StopNetLog();
+
+ virtual ~CronetURLRequestContextAdapter();
mmenke 2014/10/31 15:49:23 -virtual
mef 2014/10/31 20:39:16 Done.
+
+ private:
+ scoped_ptr<net::URLRequestContext> context_;
mmenke 2014/10/31 15:49:22 Should mention that the context_ and logger_ may o
mmenke 2014/10/31 15:49:23 Context should be last, after everything it depend
mef 2014/10/31 20:39:16 Done.
mef 2014/10/31 20:39:16 Done.
+ base::Thread* network_thread_;
mmenke 2014/10/31 15:49:22 Hrm...guess we can't put this into a scoped_ptr an
mef 2014/10/31 20:39:16 Acknowledged.
+ scoped_ptr<net::NetLogLogger> net_log_logger_;
+
+ // Initializes |context_| on the Network thread.
+ void InitializeOnNetworkThread(scoped_ptr<URLRequestContextConfig> config,
mmenke 2014/10/31 15:49:22 Fix indent (Either move config to the next line, o
mef 2014/10/31 20:39:16 Done.
+ const base::Closure& init_java_network_thread);
mmenke 2014/10/31 15:49:22 Should include callback.h
mef 2014/10/31 20:39:16 Done.
+ void StartNetLogToFileOnNetworkThread(const std::string& file_name);
+ void StopNetLogOnNetworkThread();
+
+ DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
+};
+
+} // namespace cronet
+
+#endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_

Powered by Google App Engine
This is Rietveld 408576698