Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Issue 10900020: Fix regression in BrowserThread's optimization of when it skips a lock. The variable name was misna… (Closed)

Created:
8 years, 3 months ago by jam
Modified:
8 years, 3 months ago
Reviewers:
Jói
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam
Visibility:
Public.

Description

Fix regression in BrowserThread's optimization of when it skips a lock. The variable name was misnamed before, which contributed to this. I've updated the variable name to make it clearer. Credit to liujundota@gmail.com who noticed this. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=153977

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -4 lines) Patch
M content/browser/browser_thread_impl.cc View 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
jam
8 years, 3 months ago (2012-08-29 06:09:42 UTC) #1
jam
test8 On Thu, Aug 30, 2012 at 6:31 PM, John Abd-El-Malek <jam@chromium.org> wrote: > test ...
8 years, 3 months ago (2012-08-31 01:58:03 UTC) #2
jam
test9 On Thu, Aug 30, 2012 at 7:11 PM, John Abd-El-Malek <jam@chromium.org> wrote: > (for ...
8 years, 3 months ago (2012-08-31 16:14:49 UTC) #3
jam
test11 On Wed, Oct 3, 2012 at 6:13 PM, John Abd-El-Malek <jam@chromium.org> wrote: > test10 ...
8 years, 2 months ago (2012-10-04 01:14:03 UTC) #4
jam
test14 On Wed, Oct 3, 2012 at 10:45 PM, John Abd-El-Malek <jam@chromium.org> wrote: > test13 ...
8 years, 2 months ago (2012-10-04 05:49:48 UTC) #5
jam
test13 On Wed, Oct 3, 2012 at 6:30 PM, John Abd-El-Malek <jam@chromium.org> wrote: > test12 ...
8 years, 2 months ago (2012-10-04 05:51:36 UTC) #6
jam
test10 On Fri, Aug 31, 2012 at 9:14 AM, John Abd-El-Malek <jam@chromium.org> wrote: > test9 ...
8 years, 2 months ago (2012-10-04 05:57:01 UTC) #7
jam
8 years, 2 months ago (2012-10-04 06:17:02 UTC) #8
test12

On Wed, Oct 3, 2012 at 6:13 PM, John Abd-El-Malek <jam@chromium.org> wrote:

> test10
>
>
> On Fri, Aug 31, 2012 at 9:14 AM, John Abd-El-Malek <jam@chromium.org>wrote:
>
>> test9
>>
>>
>> On Thu, Aug 30, 2012 at 7:11 PM, John Abd-El-Malek <jam@chromium.org>wrote:
>>
>>> (for those wondering, I'm testing out fixes for reply-by-email, which
>>> has been mostly busted for a while)
>>>
>>>
>>> On Thu, Aug 30, 2012 at 6:58 PM, John Abd-El-Malek <jam@chromium.org>wrote:
>>>
>>>> test8
>>>>
>>>>
>>>> On Thu, Aug 30, 2012 at 6:31 PM, John Abd-El-Malek
<jam@chromium.org>wrote:
>>>>
>>>>> test 7
>>>>>
>>>>>
>>>>> On Thu, Aug 30, 2012 at 6:24 PM, John Abd-El-Malek
<jam@chromium.org>wrote:
>>>>>
>>>>>> test6
>>>>>>
>>>>>>
>>>>>> On Thu, Aug 30, 2012 at 6:20 PM, John Abd-El-Malek
<jam@chromium.org>wrote:
>>>>>>
>>>>>>> test4
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Aug 30, 2012 at 5:44 PM, John Abd-El-Malek <jam@chromium.org
>>>>>>> > wrote:
>>>>>>>
>>>>>>>> (test again)
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 29, 2012 at 2:23 PM, John Abd-El-Malek <
>>>>>>>> jam@chromium.org> wrote:
>>>>>>>>
>>>>>>>>> Done (also testing rietveld update by email)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 29, 2012 at 7:30 AM, Jói Sigurðsson
<joi@chromium.org>wrote:
>>>>>>>>>
>>>>>>>>>> Doh!  I started writing a long essay on why this was wrong, but
>>>>>>>>>> it's not.  LGTM.
>>>>>>>>>>
>>>>>>>>>> The variable name was confusing before, and also the comment on
>>>>>>>>>> lines
>>>>>>>>>> 234-236 is a bit too wishy-washy, can you improve the comment to
>>>>>>>>>> say
>>>>>>>>>> "target thread" and "current thread" instead of "other thread" and
>>>>>>>>>> "this one"?  Maybe even add "since in that case the target
>>>>>>>>>> thread's
>>>>>>>>>> destructor, which clears its entry from globals.threads, cannot
>>>>>>>>>> run
>>>>>>>>>> while the current thread is running"?
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Jói
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Aug 28, 2012 at 11:09 PM,  <jam@chromium.org> wrote:
>>>>>>>>>> > Reviewers: Jói,
>>>>>>>>>> >
>>>>>>>>>> > Description:
>>>>>>>>>> > Fix regression in BrowserThread's optimization of when it skips
>>>>>>>>>> a lock. The
>>>>>>>>>> > variable name was misnamed before, which contributed to this.
>>>>>>>>>> I've updated
>>>>>>>>>> > the
>>>>>>>>>> > variable name to make it clearer.
>>>>>>>>>> >
>>>>>>>>>> > Credit to liujundota@gmail.com who noticed this.
>>>>>>>>>> >
>>>>>>>>>> > Please review this at http://codereview.chromium.org/10900020/
>>>>>>>>>> >
>>>>>>>>>> > SVN Base: svn://chrome-svn/chrome/trunk/src/
>>>>>>>>>> >
>>>>>>>>>> > Affected files:
>>>>>>>>>> >   M     content/browser/browser_thread_impl.cc
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>> > Index: content/browser/browser_thread_impl.cc
>>>>>>>>>> >
>>>>>>>>>> ===================================================================
>>>>>>>>>> > --- content/browser/browser_thread_impl.cc      (revision
>>>>>>>>>> 153862)
>>>>>>>>>> > +++ content/browser/browser_thread_impl.cc      (working copy)
>>>>>>>>>> > @@ -238,12 +238,12 @@
>>>>>>>>>> >    // which would require a lock because std::map isn't thread
>>>>>>>>>> safe,
>>>>>>>>>> > defeating
>>>>>>>>>> >    // the whole purpose of this optimization.
>>>>>>>>>> >    BrowserThread::ID current_thread;
>>>>>>>>>> > -  bool guaranteed_to_outlive_target_thread =
>>>>>>>>>> > +  bool target_thread_outlives_current =
>>>>>>>>>> >        GetCurrentThreadIdentifier(&current_thread) &&
>>>>>>>>>> > -      current_thread <= identifier;
>>>>>>>>>> > +      current_thread >= identifier;
>>>>>>>>>> >
>>>>>>>>>> >    BrowserThreadGlobals& globals = g_globals.Get();
>>>>>>>>>> > -  if (!guaranteed_to_outlive_target_thread)
>>>>>>>>>> > +  if (!target_thread_outlives_current)
>>>>>>>>>> >      globals.lock.Acquire();
>>>>>>>>>> >
>>>>>>>>>> >    MessageLoop* message_loop = globals.threads[identifier] ?
>>>>>>>>>> > @@ -256,7 +256,7 @@
>>>>>>>>>> >      }
>>>>>>>>>> >    }
>>>>>>>>>> >
>>>>>>>>>> > -  if (!guaranteed_to_outlive_target_thread)
>>>>>>>>>> > +  if (!target_thread_outlives_current)
>>>>>>>>>> >      globals.lock.Release();
>>>>>>>>>> >
>>>>>>>>>> >    return !!message_loop;
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Powered by Google App Engine
This is Rietveld 408576698