OSDN Git Service

Stop using |instance_| in Runtime::InitNativeMethods.
authorPiotr Jastrzebski <haaawk@google.com>
Thu, 16 Oct 2014 10:04:27 +0000 (11:04 +0100)
committerPiotr Jastrzebski <haaawk@google.com>
Thu, 16 Oct 2014 10:15:57 +0000 (11:15 +0100)
Runtime::InitNativeMethods is a member function so we
don't need to use |instance_| to call Runtime methods there.

I believe that this call uses |instance_| instead of |this|
because it was originally in a static Runtime::Create method.
It was originally called 'instance_->InitLibraries();' and was
moved to Runtime::Start which is a member function here:
http://ag/#/c/133053/6/src/runtime.cc
and since then it was further moved and renamed but it kept using |instance_|
even though use of |this| seems more appropriate.

Change-Id: I79b9d23873272ba2f124e285602f1b2683c2f27f

runtime/runtime.cc

index 3bd825b..62aef29 100644 (file)
@@ -914,7 +914,7 @@ void Runtime::InitNativeMethods() {
   {
     std::string mapped_name(StringPrintf(OS_SHARED_LIB_FORMAT_STR, "javacore"));
     std::string reason;
-    if (!instance_->java_vm_->LoadNativeLibrary(env, mapped_name, nullptr, &reason)) {
+    if (!java_vm_->LoadNativeLibrary(env, mapped_name, nullptr, &reason)) {
       LOG(FATAL) << "LoadNativeLibrary failed for \"" << mapped_name << "\": " << reason;
     }
   }