Closed Bug 1313878 Opened 3 years ago Closed 3 years ago

Use lambda to create runnable for dispatching to main thread in GMPCDMCallbackProxy.cpp

Categories

(Core :: Audio/Video: GMP, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: JamesCheng, Assigned: JamesCheng)

Details

Attachments

(1 file)

Use lambda to reduce lots of class declarations. 
Like:
  RefPtr<CDMProxy> proxy = mProxy;
  NS_DispatchToMainThread(
    NS_NewRunnableFunction([p = Move(proxy),
                            sid = NS_ConvertUTF8toUTF16(aSessionId),
                            aException,
                            aSystemCode,
                            msg = NS_ConvertUTF8toUTF16(aMessage)] ()
    {
      p->OnSessionError(sid,
                        aException,
                        aSystemCode,
                        msg);
    })
  );

But currently gecko did not fully support c++14, might cause

error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]

So use `copy` to the capture list.
Attachment #8805808 - Flags: review?(cpearce)
Rank: 15
Priority: -- → P1
Priority: P1 → P3
Comment on attachment 8805808 [details]
Bug 1313878 - Use lambda to create runnable for dispatching to main thread in GMPCDMCallbackProxy.cpp

https://reviewboard.mozilla.org/r/89452/#review88758
Attachment #8805808 - Flags: review?(cpearce) → review+
Thanks for review.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/909d5ee27ca7
Use lambda to create runnable for dispatching to main thread in GMPCDMCallbackProxy.cpp r=cpearce
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/909d5ee27ca7
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.