Skip to content

Commit

Permalink
Remove unnecessary manual registrations from components/
Browse files Browse the repository at this point in the history
It's dead code - done automatically now.
BUG=749244

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester
Change-Id: Id248a7be11015ed5af85a886e83045dc8f0eae35
Reviewed-on: https://chromium-review.googlesource.com/615441
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496348}
  • Loading branch information
yfriedman authored and Commit Bot committed Aug 22, 2017
1 parent 330f5e1 commit 8d84b83
Show file tree
Hide file tree
Showing 61 changed files with 3 additions and 574 deletions.
2 changes: 0 additions & 2 deletions chrome/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,6 @@ shared_library("chrome_sync_shell") {
testonly = true
sources = [
"../browser/android/chrome_sync_shell_entry_point.cc",
"../browser/android/chrome_sync_shell_main_delegate.cc",
"../browser/android/chrome_sync_shell_main_delegate.h",
"../browser/android/chrome_sync_shell_main_delegate_initializer.cc",
]
deps = [
Expand Down
24 changes: 0 additions & 24 deletions chrome/browser/android/chrome_sync_shell_main_delegate.cc

This file was deleted.

25 changes: 0 additions & 25 deletions chrome/browser/android/chrome_sync_shell_main_delegate.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// found in the LICENSE file.

#include "chrome/app/android/chrome_main_delegate_android.h"
#include "chrome/browser/android/chrome_sync_shell_main_delegate.h"

ChromeMainDelegateAndroid* ChromeMainDelegateAndroid::Create() {
return new ChromeSyncShellMainDelegate();
return new ChromeMainDelegateAndroid();
}
5 changes: 0 additions & 5 deletions components/about_ui/credit_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ static base::android::ScopedJavaLocalRef<jbyteArray> GetJavaWrapperCredits(
env, reinterpret_cast<const uint8_t*>(html_content_arr),
html_content.size());
}

// The RegisterNativesImpl is a static function, so has to be called somewhere.
bool RegisterAboutUIUtils(JNIEnv* env) {
return RegisterNativesImpl(env);
}
#endif

} // namespace about_ui
4 changes: 0 additions & 4 deletions components/autofill/android/autofill_provider_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,4 @@ void AutofillProviderAndroid::Reset() {
id_ = kNoQueryId;
}

bool RegisterAutofillProvider(JNIEnv* env) {
return RegisterNativesImpl(env);
}

} // namespace autofill
3 changes: 0 additions & 3 deletions components/autofill/android/autofill_provider_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class AutofillProviderAndroid : public AutofillProvider {

DISALLOW_COPY_AND_ASSIGN(AutofillProviderAndroid);
};

bool RegisterAutofillProvider(JNIEnv* env);

} // namespace autofill

#endif // COMPONENTS_AUTOFILL_ANDROID_AUTOFILL_PROVIDER_ANDROID_H_
4 changes: 0 additions & 4 deletions components/autofill/android/form_data_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,4 @@ bool FormDataAndroid::SimilarFormAs(const FormData& form) {
return form_.SimilarFormAs(form);
}

bool RegisterFormDataAndroid(JNIEnv* env) {
return RegisterNativesImpl(env);
}

} // namespace autofill
2 changes: 0 additions & 2 deletions components/autofill/android/form_data_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class FormDataAndroid {
DISALLOW_COPY_AND_ASSIGN(FormDataAndroid);
};

bool RegisterFormDataAndroid(JNIEnv* env);

} // namespace autofill

#endif // COMPONENTS_AUTOFILL_ANDROID_FORM_DATA_ANDROID_H_
6 changes: 0 additions & 6 deletions components/cronet/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -491,17 +491,11 @@ shared_library("cronet_tests") {
"test/cronet_url_request_context_config_test.cc",
"test/cronet_url_request_context_config_test.h",
"test/experimental_options_test.cc",
"test/experimental_options_test.h",
"test/mock_cert_verifier.cc",
"test/mock_cert_verifier.h",
"test/mock_url_request_job_factory.cc",
"test/mock_url_request_job_factory.h",
"test/native_test_server.cc",
"test/native_test_server.h",
"test/quic_test_server.cc",
"test/quic_test_server.h",
"test/sdch_test_util.cc",
"test/sdch_test_util.h",
"test/test_upload_data_stream_handler.cc",
"test/test_upload_data_stream_handler.h",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ static jlong CreateBidirectionalStream(
return reinterpret_cast<jlong>(adapter);
}

// static
bool CronetBidirectionalStreamAdapter::RegisterJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}

CronetBidirectionalStreamAdapter::CronetBidirectionalStreamAdapter(
CronetURLRequestContextAdapter* context,
JNIEnv* env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ struct PendingWriteData {
class CronetBidirectionalStreamAdapter
: public net::BidirectionalStream::Delegate {
public:
static bool RegisterJni(JNIEnv* env);

CronetBidirectionalStreamAdapter(
CronetURLRequestContextAdapter* context,
JNIEnv* env,
Expand Down
26 changes: 2 additions & 24 deletions components/cronet/android/cronet_library_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/android/base_jni_onload.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/jni_string.h"
#include "base/android/jni_utils.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "base/feature_list.h"
Expand All @@ -18,14 +19,9 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/statistics_recorder.h"
#include "base/task_scheduler/task_scheduler.h"
#include "components/cronet/android/cronet_bidirectional_stream_adapter.h"
#include "components/cronet/android/cronet_jni_registration.h"
#include "components/cronet/android/cronet_upload_data_stream_adapter.h"
#include "components/cronet/android/cronet_url_request_adapter.h"
#include "components/cronet/android/cronet_url_request_context_adapter.h"
#include "components/cronet/version.h"
#include "jni/CronetLibraryLoader_jni.h"
#include "net/android/net_jni_registrar.h"
#include "net/android/network_change_notifier_factory_android.h"
#include "net/base/network_change_notifier.h"
#include "url/url_features.h"
Expand All @@ -41,28 +37,12 @@ using base::android::ScopedJavaLocalRef;
namespace cronet {
namespace {

const base::android::RegistrationMethod kCronetRegisteredMethods[] = {
{"CronetBidirectionalStreamAdapter",
CronetBidirectionalStreamAdapter::RegisterJni},
{"CronetLibraryLoader", RegisterNativesImpl},
{"CronetUploadDataStreamAdapter", CronetUploadDataStreamAdapterRegisterJni},
{"CronetUrlRequestAdapter", CronetUrlRequestAdapterRegisterJni},
{"CronetUrlRequestContextAdapter",
CronetUrlRequestContextAdapterRegisterJni},
{"NetAndroid", net::android::RegisterJni},
};

// MessageLoop on the init thread, which is where objects that receive Java
// notifications generally live.
base::MessageLoop* g_init_message_loop = nullptr;

net::NetworkChangeNotifier* g_network_change_notifier = nullptr;

bool RegisterJNI(JNIEnv* env) {
return base::android::RegisterNativeMethods(
env, kCronetRegisteredMethods, arraysize(kCronetRegisteredMethods));
}

bool NativeInit() {
if (!base::android::OnJNIOnLoadInit())
return false;
Expand Down Expand Up @@ -90,9 +70,7 @@ jint CronetOnLoad(JavaVM* vm, void* reserved) {
if (!RegisterMainDexNatives(env) || !RegisterNonMainDexNatives(env)) {
return -1;
}
// TODO(agrieve): Delete this block, this is a no-op now.
// https://crbug.com/683256.
if (!RegisterJNI(env) || !NativeInit()) {
if (!NativeInit()) {
return -1;
}
return JNI_VERSION_1_6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ void CronetUploadDataStreamAdapter::Destroy(JNIEnv* env,
delete this;
}

bool CronetUploadDataStreamAdapterRegisterJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}

static jlong AttachUploadDataToRequest(
JNIEnv* env,
const JavaParamRef<jobject>& jupload_data_stream,
Expand Down
3 changes: 0 additions & 3 deletions components/cronet/android/cronet_upload_data_stream_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class CronetUploadDataStreamAdapter : public CronetUploadDataStream::Delegate {
DISALLOW_COPY_AND_ASSIGN(CronetUploadDataStreamAdapter);
};

// Explicitly register static JNI functions.
bool CronetUploadDataStreamAdapterRegisterJni(JNIEnv* env);

} // namespace cronet

#endif // COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_ADAPTER_H_
5 changes: 0 additions & 5 deletions components/cronet/android/cronet_url_request_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ std::string GetProxy(const net::HttpResponseInfo& info) {

} // namespace

// Explicitly register static JNI functions.
bool CronetUrlRequestAdapterRegisterJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}

static jlong CreateRequestAdapter(JNIEnv* env,
const JavaParamRef<jobject>& jurl_request,
jlong jurl_request_context_adapter,
Expand Down
2 changes: 0 additions & 2 deletions components/cronet/android/cronet_url_request_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class CronetURLRequestContextAdapter;
class IOBufferWithByteBuffer;
class TestUtil;

bool CronetUrlRequestAdapterRegisterJni(JNIEnv* env);

// An adapter from Java CronetUrlRequest object to net::URLRequest.
// Created and configured from a Java thread. Start, ReadData, and Destroy are
// posted to network thread and all callbacks into the Java CronetUrlRequest are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,6 @@ void InitializeStorageDirectory(const base::FilePath& dir) {

namespace cronet {

// Explicitly register static JNI functions.
bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}

CronetURLRequestContextAdapter::CronetURLRequestContextAdapter(
std::unique_ptr<URLRequestContextConfig> context_config)
: network_thread_(new base::Thread("network")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class TestUtil;

struct URLRequestContextConfig;

bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env);

// Adapter between Java CronetUrlRequestContext and net::URLRequestContext.
class CronetURLRequestContextAdapter
: public net::EffectiveConnectionTypeObserver,
Expand Down
35 changes: 0 additions & 35 deletions components/cronet/android/test/cronet_test_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,14 @@
#include "base/android/jni_registrar.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "base/macros.h"
#include "cronet_test_util.h"
#include "cronet_url_request_context_config_test.h"
#include "experimental_options_test.h"
#include "mock_cert_verifier.h"
#include "mock_url_request_job_factory.h"
#include "native_test_server.h"
#include "quic_test_server.h"
#include "sdch_test_util.h"
#include "test_upload_data_stream_handler.h"

namespace {

const base::android::RegistrationMethod kCronetTestsRegisteredMethods[] = {
{"MockCertVerifier", cronet::RegisterMockCertVerifier},
{"MockUrlRequestJobFactory", cronet::RegisterMockUrlRequestJobFactory},
{"NativeTestServer", cronet::RegisterNativeTestServer},
{"QuicTestServer", cronet::RegisterQuicTestServer},
{"SdchTestUtil", cronet::RegisterSdchTestUtil},
{"TestUploadDataStreamHandlerRegisterJni",
cronet::TestUploadDataStreamHandlerRegisterJni},
{"CronetUrlRequestContextConfigTest",
cronet::RegisterCronetUrlRequestContextConfigTest},
{"ExperimentalOptionsTest", cronet::RegisterExperimentalOptionsTest},
{"CronetTestUtil", cronet::TestUtil::Register},
};

} // namespace

// This is called by the VM when the shared library is first loaded.
// Checks the available version of JNI. Also, caches Java reflection artifacts.
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) {
base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
if (!base::android::OnJNIOnLoadInit()) {
return -1;
}

if (!base::android::RegisterNativeMethods(
env,
kCronetTestsRegisteredMethods,
arraysize(kCronetTestsRegisteredMethods))) {
return -1;
}
return JNI_VERSION_1_6;
}

Expand Down
4 changes: 0 additions & 4 deletions components/cronet/android/test/cronet_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,4 @@ void CleanupNetworkThread(JNIEnv* env,
->PostTask(FROM_HERE, base::Bind(&CleanupNetworkThreadOnNetworkThread));
}

bool TestUtil::Register(JNIEnv* env) {
return RegisterNativesImpl(env);
}

} // namespace cronet
3 changes: 0 additions & 3 deletions components/cronet/android/test/cronet_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class TestUtil {
// Returns underlying URLRequest.
static net::URLRequest* GetURLRequest(jlong jrequest_adapter);

// Register JNI.
static bool Register(JNIEnv* env);

private:
static void RunAfterContextInitOnNetworkThread(jlong jcontext_adapter,
const base::Closure& task);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,4 @@ static void VerifyUrlRequestContextConfig(
base::android::ConvertJavaStringToUTF8(env, jstorage_path));
}

bool RegisterCronetUrlRequestContextConfigTest(JNIEnv* env) {
return RegisterNativesImpl(env);
}

} // namespace cronet
6 changes: 0 additions & 6 deletions components/cronet/android/test/experimental_options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/cronet/android/test/experimental_options_test.h"

#include <jni.h>

#include "base/android/jni_android.h"
Expand Down Expand Up @@ -59,8 +57,4 @@ static void WriteToHostCache(JNIEnv* env,
base::android::ConvertJavaStringToUTF8(env, jaddress)));
}

bool RegisterExperimentalOptionsTest(JNIEnv* env) {
return RegisterNativesImpl(env);
}

} // namespace cronet
16 changes: 0 additions & 16 deletions components/cronet/android/test/experimental_options_test.h

This file was deleted.

Loading

0 comments on commit 8d84b83

Please sign in to comment.