-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[android] Refactor Dom and Render code #104
Conversation
Generated by 🚫 dangerJS |
mBridgeManager = WXBridgeManager.getInstance(); | ||
} | ||
|
||
static void initInstance(WXRenderManager renderManager){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
像getInstance一样,做个多线程保护?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法是给单测用的,不public
|
||
public class Actions { | ||
|
||
public static DOMAction get(String actionName,JSONArray args){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get改成create更合理写
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
回头可以打算加pooling
} | ||
|
||
|
||
public static DOMAction getInvokeMethod(String ref,String method,JSONArray args){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上,get改为create
* Created by sospartan on 01/03/2017. | ||
*/ | ||
|
||
public class Actions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
名字改成ActionCreator 或者 ActionFactory ?
@@ -319,24 +275,41 @@ public boolean handleMessage(Message msg) { | |||
|
|||
public static class MsgType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DomHandler有些冗余,消息会经过domModule -> domManger->domHandler->domManger这个序列传递,消息在domManager和DomHandler之间扔来扔去。
建议
- DomManger实现Handler.Callback
WXDomHandler.handleMessage
移动到DomManger.handleMessage
- DomHandler中仅保留
public static class MsgType
这个内部静态类
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为了尽量减少修改,执行的流程暂时不做修改。
@@ -256,9 +255,10 @@ | |||
* and {@link WXDomManager} is responsible for manage the relation of correspondence. | |||
* </p> | |||
*/ | |||
class WXDomStatement { | |||
class WXDomStatement implements DOMActionContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WXDomstatement名字有些诡异,建议下列做法2选1
- WXDomStatemtn改名为DomActionContextImp
- 直接去掉DomActionContext这个接口,WXDomstatement改名为DomActionContext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恩 这是接下来必然会发生的 不在这个PR里改了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改名我这次一起做掉,接口留着,这是为了解耦,否则容易退化
* Created by sospartan on 23/02/2017. | ||
*/ | ||
|
||
class RenderTask implements IWXRenderTask { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
名字改为RenderActionAdatpter更合理
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface是task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个类的功能是把RenderAction转换为RenderTask,重名为RenderActionAdapter或RenderActionTask更容易理解。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"RenderActionTask",用来区分一下好了
*/ | ||
|
||
class RenderTask implements IWXRenderTask { | ||
private final RenderAction mStatement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mRednerAction
@@ -236,7 +232,7 @@ | |||
* This class is very similar to {@link com.taobao.weex.dom.WXDomStatement} | |||
* @see com.taobao.weex.dom.WXDomStatement | |||
*/ | |||
class WXRenderStatement { | |||
class WXRenderStatement implements RenderActionContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
名字改为RenderActionContextImp更好些
pential break changes: WXRenderStatement#getComponentSize,DomModule#getComponentSize. It's low risk since it's a internal method, users should not dirct use it.
Impressive. May god bless this pr 😃 . |
No description provided.