Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import org.chromium.base.ThreadUtils; | |
| 8 import org.chromium.ui.base.WindowAndroid; | 7 import org.chromium.ui.base.WindowAndroid; |
| 9 | 8 |
| 10 /** | 9 /** |
| 11 * A class factory for content browser layer. | 10 * A class factory for content browser layer. |
| 12 */ | 11 */ |
| 13 public class ContentClassFactory { | 12 public class ContentClassFactory { |
| 14 private static ContentClassFactory sSingleton; | 13 private static ContentClassFactory sSingleton; |
| 15 | 14 |
| 16 /** | 15 /** |
| 17 * Sets the factory object. | 16 * Sets the factory object. |
| 18 */ | 17 */ |
| 19 public static void set(ContentClassFactory factory) { | 18 public static synchronized void set(ContentClassFactory factory) { |
|
Tima Vaisburd
2017/03/27 18:19:46
Some tests are failing because their setUp() metho
boliu
2017/03/27 18:21:55
fix the tests
Tima Vaisburd
2017/03/28 03:02:14
Used ThreadUtils.runOnUiThreadBlocking() which I o
| |
| 20 ThreadUtils.assertOnUiThread(); | |
| 21 | |
| 22 sSingleton = factory; | 19 sSingleton = factory; |
| 23 } | 20 } |
| 24 | 21 |
| 25 /** | 22 /** |
| 26 * Returns the factory object. | 23 * Returns the factory object. |
| 27 */ | 24 */ |
| 28 public static ContentClassFactory get() { | 25 public static synchronized ContentClassFactory get() { |
| 29 ThreadUtils.assertOnUiThread(); | |
| 30 | |
| 31 if (sSingleton == null) sSingleton = new ContentClassFactory(); | 26 if (sSingleton == null) sSingleton = new ContentClassFactory(); |
| 32 return sSingleton; | 27 return sSingleton; |
| 33 } | 28 } |
| 34 | 29 |
| 35 /** | 30 /** |
| 36 * Constructor. | 31 * Constructor. |
| 37 */ | 32 */ |
| 38 protected ContentClassFactory() {} | 33 protected ContentClassFactory() {} |
| 39 | 34 |
| 40 /** | 35 /** |
| 41 * Creates ContextSelectorProvider object. | 36 * Creates ContextSelectorProvider object. |
| 42 */ | 37 */ |
| 43 public ContextSelectionProvider createContextSelectionProvider( | 38 public ContextSelectionProvider createContextSelectionProvider( |
| 44 ContextSelectionProvider.ResultCallback callback, WindowAndroid wind owAndroid) { | 39 ContextSelectionProvider.ResultCallback callback, WindowAndroid wind owAndroid) { |
| 45 // Implemented by a subclass. | 40 // Implemented by a subclass. |
| 46 return null; | 41 return null; |
| 47 } | 42 } |
| 48 } | 43 } |
| OLD | NEW |