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

Unified Diff: components/devtools_bridge/android/session_dependency_factory_native.cc

Issue 704613003: Beginning implementation of SessionDependencyFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/devtools_bridge/android/session_dependency_factory_native.cc
diff --git a/components/devtools_bridge/android/session_dependency_factory_native.cc b/components/devtools_bridge/android/session_dependency_factory_native.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d92788b252fae9bbbd5a2fbf9e3b6ff2a096653b
--- /dev/null
+++ b/components/devtools_bridge/android/session_dependency_factory_native.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
mnaganov (inactive) 2014/11/05 22:38:49 nit: remove "(c)"
SeRya 2014/11/06 06:42:45 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/devtools_bridge/android/session_dependency_factory_native.h"
+#include "jni/SessionDependencyFactoryNative_jni.h"
+#include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
+
+namespace devtools_bridge {
+namespace android {
mnaganov (inactive) 2014/11/05 22:38:49 nit: please add an empty line before the anonymous
SeRya 2014/11/06 06:42:45 Done.
+namespace {
+void CheckedRelease(rtc::RefCountInterface* ptr) {
+ CHECK_EQ(0, ptr->Release());
+}
+} // namespace
+
+SessionDependencyFactoryNative::SessionDependencyFactoryNative()
+ : factory_(webrtc::CreatePeerConnectionFactory().release()) {
+}
+
+SessionDependencyFactoryNative::~SessionDependencyFactoryNative() {
+ CheckedRelease(factory_);
+}
+
+// static
+void SessionDependencyFactoryNative::RegisterNatives(JNIEnv* env) {
+ RegisterNativesImpl(env);
+}
+
+static jlong CreateFactory(JNIEnv* env, jclass jcaller) {
+ return reinterpret_cast<jlong>(new SessionDependencyFactoryNative());
mnaganov (inactive) 2014/11/05 22:38:49 nit: wrong indentation
SeRya 2014/11/06 06:42:45 Done.
+}
+
+static void DestroyFactory(JNIEnv* env, jclass jcaller, jlong ptr) {
+ delete SessionDependencyFactoryNative::cast(ptr);
mnaganov (inactive) 2014/11/05 22:38:49 nit: wrong indentation
SeRya 2014/11/06 06:42:46 Done.
+}
+
+} // namespace android
+} // namespace devtools_bridge

Powered by Google App Engine
This is Rietveld 408576698