Compute plugin name by stack trace only once
During Gerrit.install() the name is computed and saved into the plugin instance. Instead of computing it again, cache the current name from the plugin object. Change-Id: Iecafd5ec16eb23bde99c7aeb286bb8916609965b
This commit is contained in:
@@ -36,7 +36,7 @@ public class ApiGlue {
|
||||
getPluginName: @com.google.gerrit.client.api.ApiGlue::getPluginName(),
|
||||
install: function (f) {
|
||||
var p = new Plugin(this.getPluginName());
|
||||
@com.google.gerrit.client.api.ApiGlue::install(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(f,p);
|
||||
@com.google.gerrit.client.api.ApiGlue::install(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gerrit/client/api/JsUiPlugin;)(f,p);
|
||||
},
|
||||
|
||||
go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
|
||||
@@ -119,9 +119,9 @@ public class ApiGlue {
|
||||
};
|
||||
}-*/;
|
||||
|
||||
private static void install(JavaScriptObject cb, JavaScriptObject p) {
|
||||
private static void install(JavaScriptObject cb, JsUiPlugin p) {
|
||||
try {
|
||||
pluginName = PluginName.get();
|
||||
pluginName = p.name();
|
||||
invoke(cb, p);
|
||||
} finally {
|
||||
pluginName = null;
|
||||
|
@@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2013 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.client.api;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
class JsUiPlugin extends JavaScriptObject {
|
||||
final native String name() /*-{ return this.name }-*/;
|
||||
|
||||
protected JsUiPlugin() {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user