OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.init; | 5 package org.chromium.chrome.browser.init; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.res.Configuration; | 10 import android.content.res.Configuration; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // This is done here before kicking long running I/O because inflation i
ncludes accessing | 101 // This is done here before kicking long running I/O because inflation i
ncludes accessing |
102 // resource files(xmls etc) even if we are inflating views defined by th
e framework. If this | 102 // resource files(xmls etc) even if we are inflating views defined by th
e framework. If this |
103 // operation gets blocked because other long running I/O are running, we
delay onCreate(), | 103 // operation gets blocked because other long running I/O are running, we
delay onCreate(), |
104 // onStart() and first draw consequently. | 104 // onStart() and first draw consequently. |
105 | 105 |
106 setContentView(); | 106 setContentView(); |
107 if (mLaunchBehindWorkaround != null) mLaunchBehindWorkaround.onSetConten
tView(); | 107 if (mLaunchBehindWorkaround != null) mLaunchBehindWorkaround.onSetConten
tView(); |
108 | 108 |
109 // Kick off long running IO tasks that can be done in parallel. | 109 // Kick off long running IO tasks that can be done in parallel. |
110 mNativeInitializationController = new NativeInitializationController(thi
s, this); | 110 mNativeInitializationController = new NativeInitializationController(thi
s, this); |
| 111 initializeChildProcessCreationParams(); |
111 mNativeInitializationController.startBackgroundTasks(); | 112 mNativeInitializationController.startBackgroundTasks(); |
112 } | 113 } |
113 | 114 |
| 115 /** |
| 116 * Allow derived classes to initialize their own {@link ChildProcessCreation
Params}. |
| 117 */ |
| 118 protected void initializeChildProcessCreationParams() {} |
| 119 |
114 @Override | 120 @Override |
115 public void postInflationStartup() { | 121 public void postInflationStartup() { |
116 final View firstDrawView = getViewToBeDrawnBeforeInitializingNative(); | 122 final View firstDrawView = getViewToBeDrawnBeforeInitializingNative(); |
117 assert firstDrawView != null; | 123 assert firstDrawView != null; |
118 ViewTreeObserver.OnPreDrawListener firstDrawListener = | 124 ViewTreeObserver.OnPreDrawListener firstDrawListener = |
119 new ViewTreeObserver.OnPreDrawListener() { | 125 new ViewTreeObserver.OnPreDrawListener() { |
120 @Override | 126 @Override |
121 public boolean onPreDraw() { | 127 public boolean onPreDraw() { |
122 firstDrawView.getViewTreeObserver().removeOnPreDrawListener(this
); | 128 firstDrawView.getViewTreeObserver().removeOnPreDrawListener(this
); |
123 onFirstDrawComplete(); | 129 onFirstDrawComplete(); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 getDecorView().setVisibility(View.GONE); | 494 getDecorView().setVisibility(View.GONE); |
489 } | 495 } |
490 getViewTreeObserver().removeOnPreDrawListener(mPreDrawLi
stener); | 496 getViewTreeObserver().removeOnPreDrawListener(mPreDrawLi
stener); |
491 } | 497 } |
492 }); | 498 }); |
493 return true; | 499 return true; |
494 } | 500 } |
495 }; | 501 }; |
496 } | 502 } |
497 } | 503 } |
OLD | NEW |