|
|
Chromium Code Reviews|
Created:
6 years, 9 months ago by hashimoto Modified:
6 years, 9 months ago Reviewers:
kinuko CC:
chromium-reviews, tzik, jam, joi+watch-content_chromium.org, darin-cc_chromium.org, kinuko+watch, nhiroki Base URL:
svn://svn.chromium.org/chrome/trunk/src Visibility:
Public. |
DescriptionHandle has_more correctly in WebFileSystemImpl
Make WaitableCallbackResults ref-counted and a member of WebFileSystemImpl to keep it alive longer than before.
Add CallbacksUnregisterMode argument to RunCallbacks() to keep callbacks registered when necessary.
Initialize next_callbacks_id_ with 1 instead 0 to make 0 usable as an invalid ID.
Implement waitForAdditionalResult().
UnregisterCallbacks() is also responsible to unregister WaitableCallbackResults.
Corresponding patch: https://codereview.chromium.org/178333009/
BUG=347900
TEST=run_webkit_tests.sh http/tests/filesystem/\*
TEST=run_webkit_tests.sh http/tests/inspector/filesystem/\*
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=255625
Patch Set 1 : #Patch Set 2 : ifdef hack #
Total comments: 2
Patch Set 3 : rebase & rename to AddResultsAndSignal #Patch Set 4 : Fix race #
Messages
Total messages: 17 (0 generated)
Added #ifdef hack to keep compatibility between blink and chrome. (also to the blink patch) This should not break the build as long as this patch is committed before the blink path. PTAL.
lgtm https://codereview.chromium.org/188533002/diff/90001/content/child/fileapi/we... File content/child/fileapi/webfilesystem_impl.cc (right): https://codereview.chromium.org/188533002/diff/90001/content/child/fileapi/we... content/child/fileapi/webfilesystem_impl.cc:44: void SetResultsAndSignal(const base::Closure& results_closure) { SetResultsAndSignal -> AddResultsAndSignal ?
FYI: Although this change is conflicting with mine (https://codereview.chromium.org/102603014/), please feel free to commit this because your change seems to resolve my issue, too. Thanks!
https://codereview.chromium.org/188533002/diff/90001/content/child/fileapi/we... File content/child/fileapi/webfilesystem_impl.cc (right): https://codereview.chromium.org/188533002/diff/90001/content/child/fileapi/we... content/child/fileapi/webfilesystem_impl.cc:44: void SetResultsAndSignal(const base::Closure& results_closure) { On 2014/03/06 13:12:35, kinuko wrote: > SetResultsAndSignal -> AddResultsAndSignal ? Done.
The CQ bit was checked by hashimoto@chromium.org
On 2014/03/06 16:15:31, nhiroki wrote: > FYI: Although this change is conflicting with mine > (https://codereview.chromium.org/102603014/), > please feel free to commit this because your change seems to resolve my issue, > too. Thanks! Thanks, I'm going to commit this.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hashimoto@chromium.org/188533002/110001
Found a race bug and uploaded a new patch. PTAL The race was happening when functions are called in the following order: (IPC is received) ->DispatchResultsClosure() ->(The event is signaled, but no one is waiting) ->WaitableCallbackResults::Run() runs the closure WITHOUT resetting the event. -> If WaitAndRun() is called after these events, it gets no results because the event is signaled but the closure vector is empty. The new patch prevents this from happening by guaranteeing that the event is signaled iff. the closure vector is not empty.
lgtm, with one note It looks changing the if condition for m_fileSystem->waitForAdditionalResult() to while would have the same effect? Resetting manually feels a bit error prone, though this change looks right to me.
On 2014/03/07 07:59:44, kinuko wrote: > lgtm, with one note > > It looks changing the if condition for m_fileSystem->waitForAdditionalResult() > to while would have the same effect? Yes, if we changed WaitableCallbackResults::WaitAndRun() and waitForAdditionalResult() to return false when |closures| is empty, it would have the same effect. But, I prefer keeping the current semantics where waitForAdditionalResult() returns false only for unrecoverable errors. (i.e. it's no use to retry waiting if the method returns false) If we introduce the while loop and change things wrongly in future, the while loop may block the thread forever, consuming the CPU, retrying waitForAdditionalResult() for already unregistered callbacksId again and again. > Resetting manually feels a bit error prone, though this change looks right to > me. I agree manual reset is potentially error prone, but it should cause no problem as long as WaitableCallbackResults keeps its small manageable size. WDYT?
On 2014/03/07 08:26:57, hashimoto wrote: > On 2014/03/07 07:59:44, kinuko wrote: > > lgtm, with one note > > > > It looks changing the if condition for m_fileSystem->waitForAdditionalResult() > > to while would have the same effect? > Yes, if we changed WaitableCallbackResults::WaitAndRun() and > waitForAdditionalResult() to return false when |closures| is empty, it would > have the same effect. > But, I prefer keeping the current semantics where waitForAdditionalResult() > returns false only for unrecoverable errors. (i.e. it's no use to retry waiting > if the method returns false) > If we introduce the while loop and change things wrongly in future, the while > loop may block the thread forever, consuming the CPU, retrying > waitForAdditionalResult() for already unregistered callbacksId again and again. > > > Resetting manually feels a bit error prone, though this change looks right to > > me. > I agree manual reset is potentially error prone, but it should cause no problem > as long as WaitableCallbackResults keeps its small manageable size. > > WDYT? As my stamp tells I'm ok with this change (esp. if you have preference to do so), I understand there's pros/cons in this design choice (while loop could be robust but could be permissive for busy loops).
(I mean, please go ahead landing, I wanted to make sure you surely want to manually reset it) On Fri, Mar 7, 2014 at 5:48 PM, <kinuko@chromium.org> wrote: > On 2014/03/07 08:26:57, hashimoto wrote: > >> On 2014/03/07 07:59:44, kinuko wrote: >> > lgtm, with one note >> > >> > It looks changing the if condition for >> > m_fileSystem->waitForAdditionalResult() > >> > to while would have the same effect? >> Yes, if we changed WaitableCallbackResults::WaitAndRun() and >> waitForAdditionalResult() to return false when |closures| is empty, it >> would >> have the same effect. >> But, I prefer keeping the current semantics where >> waitForAdditionalResult() >> returns false only for unrecoverable errors. (i.e. it's no use to retry >> > waiting > >> if the method returns false) >> If we introduce the while loop and change things wrongly in future, the >> while >> loop may block the thread forever, consuming the CPU, retrying >> waitForAdditionalResult() for already unregistered callbacksId again and >> > again. > > > Resetting manually feels a bit error prone, though this change looks >> right >> > to > >> > me. >> I agree manual reset is potentially error prone, but it should cause no >> > problem > >> as long as WaitableCallbackResults keeps its small manageable size. >> > > WDYT? >> > > As my stamp tells I'm ok with this change (esp. if you have preference to > do > so), I understand there's pros/cons in this design choice (while loop > could be > robust but could be permissive for busy loops). > > https://codereview.chromium.org/188533002/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
On 2014/03/07 08:53:52, kinuko wrote: > (I mean, please go ahead landing, I wanted to make sure you surely want to > manually reset it) got it, thanks. > > > On Fri, Mar 7, 2014 at 5:48 PM, <mailto:kinuko@chromium.org> wrote: > > > On 2014/03/07 08:26:57, hashimoto wrote: > > > >> On 2014/03/07 07:59:44, kinuko wrote: > >> > lgtm, with one note > >> > > >> > It looks changing the if condition for > >> > > m_fileSystem->waitForAdditionalResult() > > > >> > to while would have the same effect? > >> Yes, if we changed WaitableCallbackResults::WaitAndRun() and > >> waitForAdditionalResult() to return false when |closures| is empty, it > >> would > >> have the same effect. > >> But, I prefer keeping the current semantics where > >> waitForAdditionalResult() > >> returns false only for unrecoverable errors. (i.e. it's no use to retry > >> > > waiting > > > >> if the method returns false) > >> If we introduce the while loop and change things wrongly in future, the > >> while > >> loop may block the thread forever, consuming the CPU, retrying > >> waitForAdditionalResult() for already unregistered callbacksId again and > >> > > again. > > > > > Resetting manually feels a bit error prone, though this change looks > >> right > >> > > to > > > >> > me. > >> I agree manual reset is potentially error prone, but it should cause no > >> > > problem > > > >> as long as WaitableCallbackResults keeps its small manageable size. > >> > > > > WDYT? > >> > > > > As my stamp tells I'm ok with this change (esp. if you have preference to > > do > > so), I understand there's pros/cons in this design choice (while loop > > could be > > robust but could be permissive for busy loops). > > > > https://codereview.chromium.org/188533002/ > > > > To unsubscribe from this group and stop receiving emails from it, send an email > to mailto:chromium-reviews+unsubscribe@chromium.org.
The CQ bit was checked by hashimoto@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hashimoto@chromium.org/188533002/150001
Message was sent while issue was closed.
Change committed as 255625 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
