| 
    
      
  | 
  
 Chromium Code Reviews
        
  DescriptionRemove URLRequest::OrphanJob().
This is a relic of a bygone era, when URLRequestJob was refcounted, and
could outlive its URLRequest. Now we can just delete the URLRequestJob.
Also remove a couple checks in URLRequestHttpJob and
ServiceWorkerURLRequestJob that their request is not NULL, as the checks
are no longer needed, for the same reason.
BUG=NONE
Committed: https://crrev.com/7ce675a75cf2f2e78a45e680c4cf22d8df521484
Cr-Commit-Position: refs/heads/master@{#430301}
   
  Patch Set 1 #Patch Set 2 : Remove method definition, too. :) #
      Total comments: 1
      
     
  
  Patch Set 3 : Fix ServiceWorker #
      Total comments: 3
      
     
  
  Patch Set 4 : Response to comments #
 Messages
    Total messages: 40 (28 generated)
     
  
  
 The CQ bit was checked by mmenke@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: android_cronet on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_cron...) ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) 
 The CQ bit was checked by mmenke@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 mmenke@chromium.org changed reviewers: + xunjieli@chromium.org 
 Not exactly an important CL, just noticed I missed some stuff when removing reference counting URLRequestJob a while back. https://codereview.chromium.org/2480563002/diff/20001/net/url_request/url_req... File net/url_request/url_request.cc (right): https://codereview.chromium.org/2480563002/diff/20001/net/url_request/url_req... net/url_request/url_request.cc:190: context_->url_requests()->erase(this); This admittedly isn't really related to the CL, just seems like we shouldn't be CHECKing here, unless we have a reason to believe this isn't working, or it's particularly important for some reason. 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: cast_shell_linux on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linu...) 
 The CQ bit was checked by mmenke@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 mmenke@chromium.org changed reviewers: + falken@chromium.org 
 [+falken]: PTAL. https://codereview.chromium.org/2480563002/diff/40001/content/browser/service... File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/2480563002/diff/40001/content/browser/service... content/browser/service_worker/service_worker_write_to_cache_job.cc:75: DCHECK_EQ(did_notify_started_, did_notify_finished_); This is not a guarantee that URLRequest makes. 
 Oops, falken: PTAL at content/browser/service_worker/service_worker_write_to_cache_job.cc 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) 
 The CQ bit was checked by mmenke@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...) 
 lgtm. This also means we can remove the following code in
ServiceWorkerURLRequestJob::DidDispatchFetchEvent, right?
  // Check if we're not orphaned.
  if (!request()) {
    RecordResult(ServiceWorkerMetrics::REQUEST_JOB_ERROR_NO_REQUEST);
    return;
  }
https://codereview.chromium.org/2480563002/diff/40001/content/browser/service...
File content/browser/service_worker/service_worker_write_to_cache_job.cc
(right):
https://codereview.chromium.org/2480563002/diff/40001/content/browser/service...
content/browser/service_worker/service_worker_write_to_cache_job.cc:75:
DCHECK_EQ(did_notify_started_, did_notify_finished_);
On 2016/11/03 21:01:18, mmenke wrote:
> This is not a guarantee that URLRequest makes.
Thanks for fixing this. Just to make sure I understand, now that we call Kill()
here the DCHECK is valid (since Kill() sets did_notify_finished_ if
did_notify_started is true), right?
          
 Description was changed from ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delte the URLRequestJob. Also remove a couple checks in URLRequestHttpJob that its request is not NULL, as they're no longer needed for the same reason. BUG=NONE ========== to ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob that its request is not NULL, as they're no longer needed for the same reason. BUG=NONE ========== 
 On 2016/11/04 05:28:50, falken wrote:
> lgtm. This also means we can remove the following code in
> ServiceWorkerURLRequestJob::DidDispatchFetchEvent, right?
> 
>   // Check if we're not orphaned.
>   if (!request()) {
>     RecordResult(ServiceWorkerMetrics::REQUEST_JOB_ERROR_NO_REQUEST);
>     return;
>   }
Correct.  I've gone ahead and removed it in this cl, along with another
request() is NULL check. I've left in the metric value, though.
https://codereview.chromium.org/2480563002/diff/40001/content/browser/service...
File content/browser/service_worker/service_worker_write_to_cache_job.cc
(right):
https://codereview.chromium.org/2480563002/diff/40001/content/browser/service...
content/browser/service_worker/service_worker_write_to_cache_job.cc:75:
DCHECK_EQ(did_notify_started_, did_notify_finished_);
On 2016/11/04 05:28:49, falken wrote:
> On 2016/11/03 21:01:18, mmenke wrote:
> > This is not a guarantee that URLRequest makes.
> 
> Thanks for fixing this. Just to make sure I understand, now that we call
Kill()
> here the DCHECK is valid (since Kill() sets did_notify_finished_ if
> did_notify_started is true), right?
Correct.  The DCHECK was relying on Kill() always being called before the
request is destroyed, which URLRequest used to do (Needlessly - it was needed
before we released the URLRequest's reference when it was refcounted, but now
only this code requires it).  So calling Kill() here, at the start of the
destructor, means that this DCHECK is still correct.  I'm not sure whether it's
still needed or not, so I'm keeping the DCHECK around.
          
 Description was changed from ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob that its request is not NULL, as they're no longer needed for the same reason. BUG=NONE ========== to ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob and ServiceWorkerURLRequestJob that their request is not NULL, as the checks are no longer needed, for the same reason. BUG=NONE ========== 
 The CQ bit was checked by mmenke@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 lgtm. Is URLRequestJob::Kill() something we can get rid of in the future? After removal of OrphanJob(), Kill() is only used in cancellation by the request, and it seems odd that URLRequestJob::Kill() notifies the request when it's being canceled by the request. 
 On 2016/11/07 15:09:08, xunjieli wrote: > lgtm. > Is URLRequestJob::Kill() something we can get rid of in the future? After > removal of OrphanJob(), Kill() is only used in cancellation by the request, and > it seems odd that URLRequestJob::Kill() notifies the request when it's being > canceled by the request. In addition to the notification, Kill() cancels all pending notifications. Unless we make deleting the job the only way to cancel it, we'll need to keep Kill(), even if we get rid of that notification. 
 The CQ bit was checked by mmenke@chromium.org 
 The patchset sent to the CQ was uploaded after l-g-t-m from falken@chromium.org Link to the patchset: https://codereview.chromium.org/2480563002/#ps60001 (title: "Response to comments") 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 On 2016/11/07 15:12:46, mmenke wrote: > On 2016/11/07 15:09:08, xunjieli wrote: > > lgtm. > > Is URLRequestJob::Kill() something we can get rid of in the future? After > > removal of OrphanJob(), Kill() is only used in cancellation by the request, > and > > it seems odd that URLRequestJob::Kill() notifies the request when it's being > > canceled by the request. > > In addition to the notification, Kill() cancels all pending notifications. > Unless we make deleting the job the only way to cancel it, we'll need to keep > Kill(), even if we get rid of that notification. Ok. that makes sense. A minor improvement could be to rename Kill() to Cancel() (not in this CL) so it's more inlined with the rest of the stack. 
 On 2016/11/07 15:28:21, xunjieli wrote: > On 2016/11/07 15:12:46, mmenke wrote: > > On 2016/11/07 15:09:08, xunjieli wrote: > > > lgtm. > > > Is URLRequestJob::Kill() something we can get rid of in the future? After > > > removal of OrphanJob(), Kill() is only used in cancellation by the request, > > and > > > it seems odd that URLRequestJob::Kill() notifies the request when it's being > > > canceled by the request. > > > > In addition to the notification, Kill() cancels all pending notifications. > > Unless we make deleting the job the only way to cancel it, we'll need to keep > > Kill(), even if we get rid of that notification. > > Ok. that makes sense. A minor improvement could be to rename Kill() to Cancel() > (not in this CL) so it's more inlined with the rest of the stack. That sounds like a good idea to me. We're doing more work in this space, and once we have a better idea just where we're going to end up, I'll do the rename, if we still need the method. 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob and ServiceWorkerURLRequestJob that their request is not NULL, as the checks are no longer needed, for the same reason. BUG=NONE ========== to ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob and ServiceWorkerURLRequestJob that their request is not NULL, as the checks are no longer needed, for the same reason. BUG=NONE ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Committed patchset #4 (id:60001) 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob and ServiceWorkerURLRequestJob that their request is not NULL, as the checks are no longer needed, for the same reason. BUG=NONE ========== to ========== Remove URLRequest::OrphanJob(). This is a relic of a bygone era, when URLRequestJob was refcounted, and could outlive its URLRequest. Now we can just delete the URLRequestJob. Also remove a couple checks in URLRequestHttpJob and ServiceWorkerURLRequestJob that their request is not NULL, as the checks are no longer needed, for the same reason. BUG=NONE Committed: https://crrev.com/7ce675a75cf2f2e78a45e680c4cf22d8df521484 Cr-Commit-Position: refs/heads/master@{#430301} ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Patchset 4 (id:??) landed as https://crrev.com/7ce675a75cf2f2e78a45e680c4cf22d8df521484 Cr-Commit-Position: refs/heads/master@{#430301}  | 
    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
