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.util; | 5 package org.chromium.chrome.browser.util; |
6 | 6 |
7 import org.chromium.base.VisibleForTesting; | 7 import org.chromium.base.VisibleForTesting; |
8 import org.chromium.base.annotations.SuppressFBWarnings; | 8 import org.chromium.base.annotations.SuppressFBWarnings; |
9 | 9 |
10 /** | 10 /** |
(...skipping 25 matching lines...) Expand all Loading... |
36 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") | 36 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
37 public synchronized boolean calledOnValidThread() { | 37 public synchronized boolean calledOnValidThread() { |
38 ensureThreadIdAssigned(); | 38 ensureThreadIdAssigned(); |
39 return mThreadId.equals(Thread.currentThread().getId()); | 39 return mThreadId.equals(Thread.currentThread().getId()); |
40 } | 40 } |
41 | 41 |
42 private void ensureThreadIdAssigned() { | 42 private void ensureThreadIdAssigned() { |
43 if (mThreadId == null) mThreadId = Thread.currentThread().getId(); | 43 if (mThreadId == null) mThreadId = Thread.currentThread().getId(); |
44 } | 44 } |
45 } | 45 } |
OLD | NEW |