Closed
      
        Bug 841014
      
      
        Opened 12 years ago
          Closed 12 years ago
      
        
    
  
Convert TimeRanges to WebIDL  
    Categories
(Core :: DOM: Core & HTML, defect)
        Core
          
        
        
      
        
    
        DOM: Core & HTML
          
        
        
      
        
    Tracking
()
        RESOLVED
        FIXED
        
    
  
        
            mozilla22
        
    
  
People
(Reporter: baku, Assigned: baku)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 6 obsolete files)
| 48.92 KB,
          patch         | baku
:
              
              review+ | Details | Diff | Splinter Review | 
| 6.00 KB,
          patch         | baku
:
              
              review+ | Details | Diff | Splinter Review | 
      No description provided.
| Assignee | ||
| Comment 1•12 years ago
           | ||
        Attachment #715099 -
        Flags: review?(Ms2ger)
| Assignee | ||
| Comment 2•12 years ago
           | ||
        Attachment #715100 -
        Flags: review?(Ms2ger)
| Comment 3•12 years ago
           | ||
Comment on attachment 715099 [details] [diff] [review]
part 1 - renaming
Review of attachment 715099 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/Makefile.in
@@ +67,5 @@
>  		HTMLTitleElement.h \
>  		HTMLUnknownElement.h \
>  		UndoManager.h \
>  		ValidityState.h \
> +		TimeRanges.h \
T goes before U
::: content/html/content/src/nsTimeRanges.cpp
@@ +16,5 @@
> +NS_IMPL_ADDREF(TimeRanges)
> +NS_IMPL_RELEASE(TimeRanges)
> +
> +
> +NS_INTERFACE_MAP_BEGIN(TimeRanges)
Just one newline above
::: content/html/content/src/nsTimeRanges.h
@@ +4,5 @@
>   * License, v. 2.0. If a copy of the MPL was not distributed with this
>   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
>  
> +#ifndef mozilla_dom__TimeRanges_h__
> +#define mozilla_dom__TimeRanges_h__
Drop a couple of underscores: mozilla_dom_TimeRanges_h
::: content/media/MediaDecoder.cpp
@@ +533,5 @@
>   * If aValue is not inside a range, false is returned, and aIntervalIndex, if
>   * not null, is set to the index of the range which ends immediately before aValue
>   * (and can be -1 if aValue is before aRanges.Start(0)).
>   */
> +static bool IsInRanges(TimeRanges& aRanges, double aValue, int32_t& aIntervalIndex) {
Move the { to the next line while you're here.
        Attachment #715099 -
        Flags: review?(Ms2ger) → review+
| Comment 4•12 years ago
           | ||
Comment on attachment 715100 [details] [diff] [review]
part 2 - webidl
Review of attachment 715100 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/html/content/src/TimeRanges.cpp
@@ +25,2 @@
>    NS_INTERFACE_MAP_ENTRY(nsIDOMTimeRanges)
> +  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTimeRanges)
I don't understand why this would suddenly be ambiguous. nsWrapperCache doesn't inherit from nsISupports.
@@ +54,5 @@
> +TimeRanges::Start(uint32_t aIndex, ErrorResult& aRv)
> +{
> +  double ret;
> +  aRv = Start(aIndex, &ret);
> +  return ret;
I would prefer switching them around; i.e., XPCOM Start calls WebIDL Start.
@@ +134,5 @@
>  }
>  
> +JSObject*
> +TimeRanges::WrapObject(JSContext* aCx, JSObject* aScope,
> +                          bool* aTriedToWrap)
Indentation
::: content/html/content/src/TimeRanges.h
@@ +30,3 @@
>    NS_DECL_NSIDOMTIMERANGES
>  
>    TimeRanges();
You don't want people to call this constructor, do you? Make it private and MOZ_DELETE, please.
@@ +49,5 @@
> +  {
> +    return mRanges.Length();
> +  }
> +
> +  virtual double Start(uint32_t aIndex, ErrorResult& aRv);
Not virtual
::: dom/bindings/Bindings.conf
@@ +955,5 @@
>  }],
>  
> +'TimeRanges': {
> +    'hasInstanceInterface': 'nsIDOMTimeRanges',
> +},
Drop this
        Attachment #715100 -
        Flags: review?(Ms2ger) → review+
| Comment 5•12 years ago
           | ||
And a followup to get rid of the classinfo, if you don't want to do that in this bug.
| Assignee | ||
| Comment 6•12 years ago
           | ||
> You don't want people to call this constructor, do you? Make it private and
> MOZ_DELETE, please.
Actually yes. TimeRanges is used in many place of the code just for calculations.
I don't think we should change all of those code.
| Assignee | ||
| Comment 7•12 years ago
           | ||
        Attachment #715099 -
        Attachment is obsolete: true
        Attachment #719854 -
        Flags: review+
| Assignee | ||
| Comment 8•12 years ago
           | ||
        Attachment #715100 -
        Attachment is obsolete: true
        Attachment #719855 -
        Flags: review+
| Assignee | ||
| Updated•12 years ago
           | 
        Attachment #719855 -
        Attachment is obsolete: true
| Assignee | ||
| Updated•12 years ago
           | 
Keywords: checkin-needed
| Assignee | ||
| Comment 10•12 years ago
           | ||
| Comment 11•12 years ago
           | ||
And could you please file a followup to get rid of the classinfo?
| Comment 12•12 years ago
           | ||
Comment on attachment 719856 [details] [diff] [review]
part 2 - webidl
Review of attachment 719856 [details] [diff] [review]:
-----------------------------------------------------------------
I think that we can make this |'wrapperCache': False| and not implement nsWrapperCache, we only ever return this by creating a new TimeRanges object so the cache is useless. This would also mean we can remove the parent stuff.
::: content/html/content/src/TimeRanges.cpp
@@ +15,5 @@
>  
>  namespace mozilla {
>  namespace dom {
>  
> +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(TimeRanges)
You'd need to add mParent here if we keep storing that or we'll leak.
@@ +25,2 @@
>    NS_INTERFACE_MAP_ENTRY(nsIDOMTimeRanges)
> +  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTimeRanges)
This shouldn't be needed.
| Assignee | ||
| Updated•12 years ago
           | 
Keywords: checkin-needed
| Assignee | ||
| Comment 13•12 years ago
           | ||
| Assignee | ||
| Comment 14•12 years ago
           | ||
        Attachment #719856 -
        Attachment is obsolete: true
        Attachment #719919 -
        Flags: review?(peterv)
| Assignee | ||
| Comment 15•12 years ago
           | ||
        Attachment #719919 -
        Attachment is obsolete: true
        Attachment #719919 -
        Flags: review?(peterv)
        Attachment #720290 -
        Flags: review?(peterv)
| Comment 16•12 years ago
           | ||
Comment on attachment 720290 [details] [diff] [review]
part 2 - webidl
Review of attachment 720290 [details] [diff] [review]:
-----------------------------------------------------------------
Since we're not traversing anything anymore there's no need for the cycle collector stuff.
::: content/html/content/src/TimeRanges.cpp
@@ +16,5 @@
>  namespace mozilla {
>  namespace dom {
>  
> +NS_IMPL_CYCLE_COLLECTING_ADDREF(TimeRanges)
> +NS_IMPL_CYCLE_COLLECTING_RELEASE(TimeRanges)
Undo this change.
@@ +21,2 @@
>  
> +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeRanges)
And this.
@@ +32,5 @@
> +  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
> +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
> +
> +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TimeRanges)
> +NS_IMPL_CYCLE_COLLECTION_UNLINK_END
And this.
::: content/html/content/src/TimeRanges.h
@@ +22,5 @@
>  class TimeRanges MOZ_FINAL : public nsIDOMTimeRanges
>  {
>  public:
> +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
> +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeRanges)
And this.
        Attachment #720290 -
        Flags: review?(peterv) → review+
| Assignee | ||
| Comment 17•12 years ago
           | ||
        Attachment #720290 -
        Attachment is obsolete: true
        Attachment #720297 -
        Flags: review+
| Assignee | ||
| Updated•12 years ago
           | 
Keywords: checkin-needed
| Comment 18•12 years ago
           | ||
https://hg.mozilla.org/integration/mozilla-inbound/rev/bfedd81983e9
https://hg.mozilla.org/integration/mozilla-inbound/rev/d55e76187db5
Flags: in-testsuite?
Keywords: checkin-needed
| Comment 19•12 years ago
           | ||
https://hg.mozilla.org/mozilla-central/rev/bfedd81983e9
https://hg.mozilla.org/mozilla-central/rev/d55e76187db5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
| Updated•6 years ago
           | 
Component: DOM → DOM: Core & HTML
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•