Skip to content

Commit

Permalink
Mojom: Blanket change to mark all pointer/handle fields as nullable.
Browse files Browse the repository at this point in the history
The purpose is to make those APIs have the same semantics as before. And
then we can selectively turn fields into non-nullable.

Mojom files that are not included in this change:
- surface-related files: the owner (jamesr) has landed some non-nullable
  fixes. It is possible that he has fully reviewed them. (I will confirm
  with him.)
- test files: have been examined.

BUG=324170
TEST=None

Review URL: https://codereview.chromium.org/502853002

Cr-Commit-Position: refs/heads/master@{#291862}
  • Loading branch information
yzshen authored and Commit bot committed Aug 26, 2014
1 parent 0ab900d commit 7182448
Show file tree
Hide file tree
Showing 29 changed files with 89 additions and 87 deletions.
2 changes: 1 addition & 1 deletion content/common/render_frame_setup.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module content {

interface RenderFrameSetup {
GetServiceProviderForFrame(int32 frame_routing_id,
mojo.ServiceProvider& service_provider);
mojo.ServiceProvider&? service_provider);
};

}
4 changes: 2 additions & 2 deletions device/serial/data_stream.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module device.serial {
interface DataSource {
// Initializes this DataSource with a data pipe handle to use for data
// transmission.
Init(handle<data_pipe_producer> producer_handle);
Init(handle<data_pipe_producer>? producer_handle);

// Resumes sending data after it has been stopped due to an error.
Resume();
Expand All @@ -25,7 +25,7 @@ interface DataSourceClient {
interface DataSink {
// Initializes this DataSink with a data pipe handle to use for data
// transmission.
Init(handle<data_pipe_consumer> consumer_handle);
Init(handle<data_pipe_consumer>? consumer_handle);

// Requests the cancellation of any data that has been written to the pipe,
// but has not yet been sent to the sink.
Expand Down
14 changes: 7 additions & 7 deletions device/serial/serial.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ struct DeviceControlSignals {
};

interface SerialService {
GetDevices() => (DeviceInfo[] devices);
GetDevices() => (DeviceInfo?[]? devices);

// Creates a |Connection| to |path| with options specified by |options|,
// returning it via |connection|. This will fail and |connection| will not be
// usable if |path| does not specify a valid serial device or there is an
// error connecting to or configuring the connection.
Connect(string path,
ConnectionOptions options,
Connection& connection);
Connect(string? path,
ConnectionOptions? options,
Connection&? connection);
};

interface Connection {
GetInfo() => (ConnectionInfo? info);
SetOptions(ConnectionOptions options) => (bool success);
SetControlSignals(HostControlSignals signals) => (bool success);
GetControlSignals() => (DeviceControlSignals signals);
SetOptions(ConnectionOptions? options) => (bool success);
SetControlSignals(HostControlSignals? signals) => (bool success);
GetControlSignals() => (DeviceControlSignals? signals);
Flush() => (bool success);
};

Expand Down
2 changes: 1 addition & 1 deletion mojo/application_manager/test.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module mojo {

[Client=TestClient]
interface TestService {
Test(string test_string);
Test(string? test_string);
};

interface TestClient {
Expand Down
2 changes: 1 addition & 1 deletion mojo/examples/echo/echo_service.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module mojo.examples {

interface EchoService {
EchoString(string value) => (string value);
EchoString(string? value) => (string? value);
};

}
2 changes: 1 addition & 1 deletion mojo/examples/window_manager/window_manager.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IWindowManager {
// Shows the keyboard for the specified view. |bounds| is the bounds of the
// view that is showing focus. |bounds| is relative to the bounds of the node.
// Events from the keyboard are routed to the view with id |view_id|.
ShowKeyboard(uint32 view_id, mojo.Rect bounds);
ShowKeyboard(uint32 view_id, mojo.Rect? bounds);

// Hides the keyboard. This is ignored if |view_id| is not the view that was
// last passed to ShowKeyboard().
Expand Down
2 changes: 1 addition & 1 deletion mojo/public/interfaces/application/application.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module mojo {
// implement Interfaces.
[Client=Shell]
interface Application {
AcceptConnection(string requestor_url, ServiceProvider provider);
AcceptConnection(string? requestor_url, ServiceProvider? provider);
};

}
2 changes: 1 addition & 1 deletion mojo/public/interfaces/application/service_provider.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module mojo {
interface ServiceProvider {
// Connect the given message pipe handle to the named service. If the named
// service does not exist, then the handle will be closed.
ConnectToService(string interface_name, handle<message_pipe> pipe);
ConnectToService(string? interface_name, handle<message_pipe>? pipe);
};

}
2 changes: 1 addition & 1 deletion mojo/public/interfaces/application/shell.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module mojo {
interface Shell {
// Loads url. mojo:{service} will result in the user of the value of the
// --origin flag to the shell being used.
ConnectToApplication(string application_url, ServiceProvider& provider);
ConnectToApplication(string? application_url, ServiceProvider&? provider);
};

}
2 changes: 1 addition & 1 deletion mojo/services/dbus_echo/echo.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module mojo {

interface EchoService {
Echo(string to_echo) => (string echoed);
Echo(string? to_echo) => (string? echoed);
};

}
8 changes: 4 additions & 4 deletions mojo/services/gles2/command_buffer.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ struct CommandBufferState {

interface CommandBufferSyncClient {
DidInitialize(bool success);
DidMakeProgress(CommandBufferState state);
DidMakeProgress(CommandBufferState? state);
};

[Client=CommandBufferClient]
interface CommandBuffer {
Initialize(CommandBufferSyncClient sync_client,
handle<shared_buffer> shared_state);
Initialize(CommandBufferSyncClient? sync_client,
handle<shared_buffer>? shared_state);
SetGetBuffer(int32 buffer);
Flush(int32 put_offset);
MakeProgress(int32 last_get_offset);
RegisterTransferBuffer(
int32 id, handle<shared_buffer> transfer_buffer, uint32 size);
int32 id, handle<shared_buffer>? transfer_buffer, uint32 size);
DestroyTransferBuffer(int32 id);
Echo() => ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import "mojo/services/public/interfaces/network/url_loader.mojom"
module mojo {

interface ContentHandler {
OnConnect(string url,
URLResponse url_response,
ServiceProvider service_provider);
OnConnect(string? url,
URLResponse? url_response,
ServiceProvider? service_provider);
};

}
2 changes: 1 addition & 1 deletion mojo/services/public/interfaces/geometry/geometry.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Rect {

struct Transform {
// Row major order.
float[16] matrix;
float[16]? matrix;
};

}
4 changes: 2 additions & 2 deletions mojo/services/public/interfaces/gpu/gpu.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import "mojo/services/public/interfaces/geometry/geometry.mojom"
module mojo {

interface Gpu {
CreateOnscreenGLES2Context(uint64 native_viewport_id, Size size, CommandBuffer& gles2_client);
CreateOffscreenGLES2Context(CommandBuffer& gles2_client);
CreateOnscreenGLES2Context(uint64 native_viewport_id, Size? size, CommandBuffer&? gles2_client);
CreateOffscreenGLES2Context(CommandBuffer&? gles2_client);
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "mojo/services/public/interfaces/input_events/input_key_codes.mojom"
module mojo {

struct LocationData {
Point in_view_location;
Point? in_view_location;
Point? screen_location;
};

Expand Down
4 changes: 2 additions & 2 deletions mojo/services/public/interfaces/launcher/launcher.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ interface Launcher {
//
// Note: |response| can be NULL in the case where a request was not needed to
// determine the correct handler.
Launch(NavigationDetails details) =>
(string handler_url, string view_url, ResponseDetails response);
Launch(NavigationDetails? details) =>
(string? handler_url, string? view_url, ResponseDetails? response);
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ module mojo {

[Client=NativeViewportClient]
interface NativeViewport {
Create(Rect bounds);
Create(Rect? bounds);
Show();
Hide();
Close();
SetBounds(Rect bounds);
SetBounds(Rect? bounds);
};

interface NativeViewportClient {
OnCreated(uint64 native_viewport_id);
OnBoundsChanged(Rect bounds);
OnBoundsChanged(Rect? bounds);
OnDestroyed();
OnEvent(Event event) => ();
OnEvent(Event? event) => ();
};

}
14 changes: 7 additions & 7 deletions mojo/services/public/interfaces/navigation/navigation.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ enum Target {
struct NavigationDetails {
// TODO(mpcomplete): will we ever need more than the URLRequest? Can
// we pass that around directly?
URLRequest request = default;
URLRequest? request = default;
};

struct ResponseDetails {
// TODO(beng): consider providing access to URLRequest too. Currently it is
// not possible to obtain from the URLLoader.

URLResponse response;
URLResponse? response;

// The URLLoader instance that generated the response. This must be kept
// alive until the response body has been completely consumed.
URLLoader loader;
URLLoader? loader;
};

// Embedders that support navigation of implement this interface.
interface NavigatorHost {
RequestNavigate(uint32 source_node_id, Target target,
NavigationDetails details);
NavigationDetails? details);

// Applications call this to inform hosts of navigations they performed
// locally. For example, pushState() navigations in an HTML application.
DidNavigateLocally(uint32 source_node_id, string url);
DidNavigateLocally(uint32 source_node_id, string? url);
};

// Applications implement this interface to support navigation of their views
Expand All @@ -51,8 +51,8 @@ interface NavigatorHost {
// network load.
interface Navigator {
Navigate(uint32 node_id,
NavigationDetails navigation_details,
ResponseDetails response_details);
NavigationDetails? navigation_details,
ResponseDetails? response_details);
};

}
4 changes: 2 additions & 2 deletions mojo/services/public/interfaces/network/cookie_store.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
module mojo {

interface CookieStore {
Get(string url) => (string cookies);
Set(string url, string cookie) => (bool success);
Get(string? url) => (string? cookies);
Set(string? url, string? cookie) => (bool success);
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module mojo {

struct NetworkError {
int32 code;
string description;
string? description;
};

}
4 changes: 2 additions & 2 deletions mojo/services/public/interfaces/network/network_service.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import "mojo/services/public/interfaces/network/url_loader.mojom"
module mojo {

interface NetworkService {
CreateURLLoader(URLLoader& loader);
CreateURLLoader(URLLoader&? loader);

GetCookieStore(CookieStore& cookie_store);
GetCookieStore(CookieStore&? cookie_store);

// TODO(darin): Add other methods here.
};
Expand Down
26 changes: 13 additions & 13 deletions mojo/services/public/interfaces/network/url_loader.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ module mojo {

struct URLRequest {
// The URL to load.
string url;
string? url;

// The HTTP method if applicable.
string method = "GET";
string? method = "GET";

// Additional HTTP request headers.
string[]? headers;
string?[]? headers;

// The payload for the request body, represented as a concatenation of data
// streams. For HTTP requests, the method must be set to "POST" or "PUT".
handle<data_pipe_consumer>[]? body;
handle<data_pipe_consumer>?[]? body;

// The number of bytes to be read from |body|. A Content-Length header of
// this value will be sent. Set to -1 if length is unknown, which will cause
Expand Down Expand Up @@ -47,25 +47,25 @@ struct URLResponse {

// The response body stream. Read from this data pipe to receive the bytes of
// response body.
handle<data_pipe_consumer> body;
handle<data_pipe_consumer>? body;

// The final URL of the response, after redirects have been followed.
string url;
string? url;

// The HTTP status code. 0 if not applicable.
uint32 status_code;

// The HTTP status line.
string status_line;
string? status_line;

// The HTTP response headers.
string[] headers;
string?[]? headers;

// The MIME type of the response body.
string mime_type;
string? mime_type;

// The character set of the response body.
string charset;
string? charset;

// These fields are set to non-NULL if this response corresponds to a
// redirect. Call the |FollowRedirect| method on the URLLoader instance to
Expand All @@ -92,15 +92,15 @@ interface URLLoader {
// Loads the given |request|, asynchronously producing |response|. Consult
// |response| to determine if the request resulted in an error, was
// redirected, or has a response body to be consumed.
Start(URLRequest request) => (URLResponse response);
Start(URLRequest? request) => (URLResponse? response);

// If the request passed to |Start| had |auto_follow_redirects| set to false,
// then upon receiving an URLResponse with a non-NULL |redirect_url| field,
// |FollowRedirect| may be called to load the URL indicated by the redirect.
FollowRedirect() => (URLResponse response);
FollowRedirect() => (URLResponse? response);

// Query status about the URLLoader.
QueryStatus() => (URLLoaderStatus status);
QueryStatus() => (URLLoaderStatus? status);
};

}
Loading

0 comments on commit 7182448

Please sign in to comment.