Closed Bug 1083092 Opened 10 years ago Closed 10 years ago

[Bluetooth] Prepare IPC classes for BT daemon

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.1 S7 (24Oct)

People

(Reporter: tzimmermann, Assigned: tzimmermann)

References

Details

Attachments

(3 files)

To support the new BT daemon, we need to add some improvements to the socket IPC classes.
Comment on attachment 8505406 [details] [diff] [review]
[01] Bug 1083092: Introduce |mozilla::ipc::SocketBase|

Everyone's on PTO...
Attachment #8505406 - Flags: review?(shuang)
Attachment #8505406 - Flags: review?(kyle)
Attachment #8505406 - Flags: feedback?(btian)
Attachment #8505407 - Flags: review?(shuang)
Attachment #8505407 - Flags: review?(kyle)
Attachment #8505407 - Flags: feedback?(btian)
Attachment #8505409 - Flags: review?(shuang)
Comment on attachment 8505406 [details] [diff] [review]
[01] Bug 1083092: Introduce |mozilla::ipc::SocketBase|

Review of attachment 8505406 [details] [diff] [review]:
-----------------------------------------------------------------

This looks fine to me.
Attachment #8505406 - Flags: review?(shuang) → review+
Comment on attachment 8505407 [details] [diff] [review]
[02] Bug 1083092: Data parameter for |mozilla::ipc::SocketIOSendTask| template

Review of attachment 8505407 [details] [diff] [review]:
-----------------------------------------------------------------

The change makes sense. I'm fine with this change, although I'm not the best person to review UnixSocket.
Attachment #8505407 - Flags: review?(shuang) → review+
Comment on attachment 8505409 [details] [diff] [review]
[03] Bug 1083092: Add |mozilla::ipc::UnixSocketIOBuffer|

Review of attachment 8505409 [details] [diff] [review]:
-----------------------------------------------------------------

::: ipc/unixsocket/SocketBase.cpp
@@ +57,5 @@
> +  const uint8_t* data = Consume(aLen);
> +  if (!data) {
> +    return NS_ERROR_OUT_OF_MEMORY;
> +  }
> +  memcpy(aValue, data, aLen);

I will be better to do sanity check for| memcpy|

@@ +67,5 @@
> +{
> +  if (((mAvailableSpace - mSize) < aLen)) {
> +    size_t availableSpace = mAvailableSpace + std::max(mAvailableSpace, aLen);
> +    uint8_t* data = new uint8_t[availableSpace];
> +    memcpy(data, mData, mSize);

I will be better to do sanity check for| memcpy|
Attachment #8505409 - Flags: review?(shuang)
Hi,

thanks for your review.

(In reply to Shawn Huang [:shawnjohnjr] from comment #7)
> Comment on attachment 8505409 [details] [diff] [review]
> [03] Bug 1083092: Add |mozilla::ipc::UnixSocketIOBuffer|
> 
> Review of attachment 8505409 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: ipc/unixsocket/SocketBase.cpp
> @@ +57,5 @@
> > +  const uint8_t* data = Consume(aLen);
> > +  if (!data) {
> > +    return NS_ERROR_OUT_OF_MEMORY;
> > +  }
> > +  memcpy(aValue, data, aLen);
> 
> I will be better to do sanity check for| memcpy|

What do you mean by 'sanity check'?
Flags: needinfo?(shuang)
I was thinking if we need to check dest buffer size is big enough. But I was wrong, we don't need to do it.
Flags: needinfo?(shuang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: