Closed Bug 870678 Opened 12 years ago Closed 11 years ago

convert DOMCameraManager to webidl

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: tbsaunde, Assigned: tbsaunde)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

No description provided.
Attachment #749746 - Flags: review?(bzbarsky)
Attached patch remove nsIDOMCameraManager (deleted) — Splinter Review
Attachment #749747 - Flags: review?(bzbarsky)
Comment on attachment 749746 [details] [diff] [review] bug 870678 - convert CameraManager to webidl Review of attachment 749746 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/camera/DOMCameraManager.cpp @@ +142,5 @@ > + const Optional<nsICameraErrorCallback*>& onError, > + ErrorResult& aRv) > +{ > + uint32_t cameraId = 0; // back (or forward-facing) camera by default > + mozilla::idl::CameraSelector selector; Why not move the CameraSelector dictionary to WebIDL a well? Then you don't need to mess with jsvals at all. ::: dom/camera/GonkCameraManager.cpp @@ +136,5 @@ > + > + if (!cameraName.EqualsLiteral("back")) { > + aList.InsertElementAt(0, NS_ConvertUTF8toUTF16(cameraName).get()); > + } else if (cameraName.EqualsLiteral("front")) { > + aList.SetLength(2); I think we have EnsureLengthAtLeast or something like that
(In reply to :Ms2ger from comment #4) > Comment on attachment 749746 [details] [diff] [review] > bug 870678 - convert CameraManager to webidl > > Review of attachment 749746 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/camera/DOMCameraManager.cpp > @@ +142,5 @@ > > + const Optional<nsICameraErrorCallback*>& onError, > > + ErrorResult& aRv) > > +{ > > + uint32_t cameraId = 0; // back (or forward-facing) camera by default > > + mozilla::idl::CameraSelector selector; > > Why not move the CameraSelector dictionary to WebIDL a well? Then you don't > need to mess with jsvals at all. I was planning to in another patch, but I didn't want to write one massive convert all of dom/camera patch :) > ::: dom/camera/GonkCameraManager.cpp > @@ +136,5 @@ > > + > > + if (!cameraName.EqualsLiteral("back")) { > > + aList.InsertElementAt(0, NS_ConvertUTF8toUTF16(cameraName).get()); > > + } else if (cameraName.EqualsLiteral("front")) { > > + aList.SetLength(2); > > I think we have EnsureLengthAtLeast or something like that yeah, I think so and that would be better.
Summary: conver DOMCameraManager to webidl → convert DOMCameraManager to webidl
Comment on attachment 749746 [details] [diff] [review] bug 870678 - convert CameraManager to webidl GetListOfCameras looks wrong (though perhaps no more wrong than what's there). Please rebase on top of the patch in bug 872122 and see what the code there looks like? >+++ b/dom/webidl/CameraManager.webidl >+ void getCamera(any options, GetCameraCallback callback, optional >+CameraErrorCallback errorCallback); I suggest line-breaking before the "optional" and fixing the indentation. >+ [Throws] >+sequence<DOMString> getListOfCameras(); Again, fix the indentation (two more spaces before "sequence"). r- because I'd like to see the fixed getListOfCameras.
Attachment #749746 - Flags: review?(bzbarsky) → review-
Comment on attachment 749747 [details] [diff] [review] remove nsIDOMCameraManager >+++ b/dom/webidl/CameraManager.webidl >+ camera: front I know you just copied this, but it should be: camera: "front" with the quotes around "front". >+ /* return a JSON array of camera identifiers, e.g. s/JSON //, since it's just an array. r=me
Attachment #749747 - Flags: review?(bzbarsky) → review+
Depends on: 872856
Attachment #750369 - Flags: review?(bzbarsky)
The patch in bug 872122 has landed on inbound.
I believe the TArray stuff is correct, but its kind of scary and I have no idea what tests this stuff if anything so certainly worth a close look
Attachment #750913 - Flags: review?(bzbarsky)
Assignee: nobody → trev.saunders
Comment on attachment 750913 [details] [diff] [review] bug 870678 - convert CameraManager to webidl >+++ b/dom/camera/DOMCameraManager.cpp >+nsDOMCameraManager::GetCamera(JSContext* aCx, const JS::Value aOptions, >+ ErrorResult& aRv) The ErrorResult line needs to be indented by one more space. >+++ b/dom/camera/GonkCameraManager.cpp >+nsDOMCameraManager::GetListOfCameras(nsTArray<nsString>& aList, ErrorResult& aRv) >+ if (count <= 0) { >+ aRv.Throw(NS_ERROR_NOT_AVAILABLE); We used to return an empty list if count < 1. Why the behavior change? >+ aList.SetLength(2); This lost the comments about _why_ we want to do that. >+ if (!cameraName.EqualsLiteral("back")) { The sense of this of this test is reversed. Please fix that. >+ aList[0] = NS_ConvertUTF8toUTF16(cameraName).get(); CopyUTF8toUTF16(cameraName, aList[0]); >+ aList[1] = NS_ConvertUTF8toUTF16(cameraName).get(); And similar here. >+ aList.InsertElementAt(extraIdx, NS_ConvertUTF8toUTF16(cameraName).get()); CopyUTF8toUTF16(cameraName, *aList.InsertElementAt(extraIdx)); >+ if (gotFront) { >+ aList.RemoveElementAt(1); >+ } >+ if (gotBack) { >+ aList.RemoveElementAt(0); >+ } This part looks wrong to me. Please fix it to actually do the right thing (like not lose the front and back cameras). Are those boolean tests just reversed, perhaps? >+++ b/dom/webidl/CameraManager.webidl Please do fix the indentation problems from the previous review.
Attachment #750913 - Flags: review?(bzbarsky) → review-
Comment on attachment 750369 [details] [diff] [review] convert cameraSelector dict to webidl So this applies on top of the other two patches, right? r=me
Attachment #750369 - Flags: review?(bzbarsky) → review+
sorry about the last patch eing totally crazy I think this one is a bit better.
Attachment #754988 - Flags: review?(bzbarsky)
Comment on attachment 754988 [details] [diff] [review] bug 870678 - convert CameraManager to webidl r=me. Sorry for the lag...
Attachment #754988 - Flags: review?(bzbarsky) → review+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: